• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

content/classes/class.ilParagraphPlugin.php

Go to the documentation of this file.
00001 <?
00002 
00003 class ParagraphPlugins {
00004         var $plugins;
00005         var $pluginDirectory;
00006         var $skipDirectories;
00007         
00008         function ParagraphPlugins () {
00009                 $this->plugins = array();
00010                 $this->pluginDirectory = ILIAS_ABSOLUTE_PATH."/content/plugins";
00011                 $this->skipDirectories = array ();
00012                 $this->skipDirectories [$this->pluginDirectory."/classes"] = "skip"; 
00013                 $this->skipDirectories [$this->pluginDirectory."/resources"]= "skip";
00014                 $this->skipDirectories [$this->pluginDirectory."/CVS"]= "skip";
00015         }
00016         
00020         function getRegisteredPluginsAsArray () {
00021                 return $this->plugins;          
00022         }
00023         
00024         
00028         function registerPlugin ($plugin) {
00029                 //echo "registered Plugin ".$plugin->getTitle();
00030                 $this->plugins[$plugin->serializeToString()] = $plugin;
00031         }
00032         
00037         function serializeToString (){
00038                 return implode ("|", array_keys($this->plugins));               
00039         }
00040         
00044         function initialize () {                
00045                 foreach (glob($this->pluginDirectory."/*",GLOB_ONLYDIR) as $pluginDir) {
00046                         if (array_key_exists($pluginDir,$this->skipDirectories))
00047                                 continue;
00048                         $pluginFile = $pluginDir . "/classes/class.plugin.php";
00049                         if (file_exists($pluginFile)) {
00050                                 include ($pluginFile);
00051                                 if (is_object($plugin)) {
00052                                         $this->registerPlugin($plugin);
00053                                         unset ($plugin);
00054                                 }
00055                         }
00056                 }       
00057         }
00058 }
00059 
00060 class ParagraphPlugin {
00061         var $properties;
00062         var $directory;
00063         
00064         function ParagraphPlugin ($directory, $title, $filetype, $link) {
00065                 $this->directory = $directory;
00066                 $this->properties = array ("filetype" => "", "title" => "", "link" => "");
00067                 $this->setTitle($title);
00068                 $this->setFileType($filetype);
00069                 $this->setLink ($link);         
00070         }
00071         
00072         function serializeToString (){          
00073                 return implode("#",$this->properties);
00074         }
00075         
00076         function setTitle ($title) {
00077                 $this->properties["title"] = $title;
00078         }
00079         
00080         function setLink ($link) {
00081                 $this->properties["link"] = $this->getPluginURL()."/".$link;
00082         }
00083         
00084         function setImage ($image) {
00085                 $this->properties["image"] = $this->getResourceURL()."/".$image;
00086         }
00087         
00088         function setFileType ($filetype) {
00089                 $this->properties["filetype"] = $filetype;
00090         }       
00091         
00092         function getTitle () {
00093                 return $this->properties["title"];
00094         }
00095                 
00096         function getPluginDir () {
00097                 return ILIAS_ABSOLUTE_PATH."/content/plugins"."/".$this->directory;
00098         }
00099         
00100         function getTemplateDir () {
00101                 return $this->getPluginDir()."/templates";      
00102         }
00103         
00104         function getClassDir () {
00105                 return $this->getPluginDir()."/classes";        
00106         }
00107         
00108         
00109         function getResourceDir () {
00110                 return $this->getPluginDir()."/resources";      
00111         }
00112         
00113         function getResourceURL () {
00114                 return ILIAS_HTTP_PATH."/content/plugins/".$this->directory."/resources";       
00115         }
00116         
00117         function getPluginURL () {
00118                 return ILIAS_HTTP_PATH."/content/plugins/".$this->directory;    
00119         }
00120 }
00121 
00122 $paragraph_plugins = new ParagraphPlugins();
00123 
00124 $paragraph_plugins->initialize ();
00125 
00126 $GLOBALS["paragraph_plugins"] = $paragraph_plugins;
00127 
00128 ?>

Generated on Fri Dec 13 2013 10:18:29 for ILIAS Release_3_5_x_branch .rev 46805 by  doxygen 1.7.1