TiddlyWiki.org

Changeset 5000

Show
Ignore:
Timestamp:
16/05/08 18:07:29 (2 months ago)
Author:
simonmcmanus
Message:

cct - working modules that allow named events

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Trunk/association/serversides/cctiddly/Branches/Modules/includes/moduleLoader.php

    r4998 r5000  
    1919        } 
    2020         
    21         public function addEvent($event){ 
    22                 array_push($this->events,$event); 
     21        public function addEvent($eventname,$event){ 
     22                if ( !isset($this->events[$eventname])) 
     23             $this->events[$eventname] = array(); 
     24                        array_push($this->events[$eventname], $event);  
    2325        } 
    2426         
     
    3133        } 
    3234         
    33         // 
    34          
    3535        public function readModules(){ 
    3636                $dir = "modules/"; 
     
    4242                                        if( is_dir($dir.$file)) 
    4343                                        { 
    44                                                 //echo $dir.$file."/index.php"; 
    45                                                         // check for index.php and remove the .. 
    46                                                         $modulePath = $dir.$file."/index.php"; 
    47                                                         if (is_file($modulePath) && $file!=='..') 
    48                                                         { 
    49                                                                 include($modulePath); 
    50                                                         } 
     44                                                // check for index.php and remove the .. 
     45                                                $modulePath = $dir.$file."/index.php"; 
     46                                                if (is_file($modulePath) && $file!=='..') 
     47                                                { 
     48                                                        include($modulePath); 
     49                                                } 
    5150                                        } 
    5251                        } 
     
    6463        } 
    6564} 
     65 
    6666global $modulesLoader; 
    6767$modulesLoader = new ModulesLoader(); 
     
    6969//this needs to make sure plugins and events are loaded by ccT 
    7070$modulesLoader->runModules(); 
    71  
    7271?> 
  • Trunk/association/serversides/cctiddly/Branches/Modules/includes/modules.php

    r4998 r5000  
    3535       
    3636      public function addEvent($eventname, $fileInclude) { 
    37                         //  array_push($this->phpEvents, $fileInclude); 
    38     
    39       if ( !isset($this->phpEvents[$eventname])) 
    40              $this->phpEvents[$eventname] = array(); 
    41                 //      print_r('saq'); 
    42                 //      print_r($this->phpEvents[$eventname]); 
    43                         array_push($this->phpEvents[$eventname], $fileInclude);  
    44                 //      print_r($this->phpEvents);   
     37            if ( !isset($this->phpEvents[$eventname])) 
     38                     $this->phpEvents[$eventname] = array(); 
     39                                array_push($this->phpEvents[$eventname], $fileInclude);  
    4540      } 
    4641       
     
    5146              $modulesLoader->addPlugin($plugin); 
    5247        } 
    53           foreach ($this->phpEvents as $event) { 
    54               $modulesLoader->addEvent($event); 
     48          foreach ($this->phpEvents as $eventnames=>$eventArray) { 
     49                                //print_r($eventnames); 
     50                        foreach ($eventArray as $event) 
     51              $modulesLoader->addEvent($eventnames,$event); 
    5552         } 
    56            foreach ($this->phpEvents as $event) { 
     53           foreach ($this->tiddlers as $event) { 
    5754              $modulesLoader->addTiddler($event); 
    5855       } 
  • Trunk/association/serversides/cctiddly/Branches/Modules/index.php

    r4998 r5000  
    598598} 
    599599 
    600 echo 'asdasdasdasd'; 
    601 print_r($modulesLoader->events); 
    602 foreach ($modulesLoader->events[0] as $event) 
     600 
     601foreach ($modulesLoader->events['loadStoreArea'] as $event) 
    603602{ 
    604603        if(is_file("Modules/".$event))