Changeset 781 for trunk/Modules/NetworkConfig/NetworkConfig.php
- Timestamp:
- Jan 8, 2016, 11:00:11 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/NetworkConfig/NetworkConfig.php
r738 r781 3 3 class ModuleNetworkConfig extends AppModule 4 4 { 5 var $ConfigItems; 6 5 7 function __construct($System) 6 8 { … … 12 14 $this->Description = 'Network device remote configuration'; 13 15 $this->Dependencies = array('Network'); 16 $this->ConfigItems = array(); 14 17 } 15 18 … … 48 51 ), 49 52 )); 53 $this->System->RegisterCommandLine('config', array($this, 'Config')); 54 } 55 56 function RegisterConfigItem($Name, $ClassName) 57 { 58 $this->ConfigItems[$Name] = $ClassName; 59 } 60 61 function UnregisterConfigItem($Name) 62 { 63 unset($this->ConfigItems[$Name]); 64 } 65 66 function Config($Parameters) 67 { 68 $Output = ''; 69 if($Parameters >= 3) 70 { 71 $ConfigItemName = $Parameters[2]; 72 if(array_key_exists($ConfigItemName, $this->ConfigItems)) 73 { 74 $ClassName = $this->ConfigItems[$ConfigItemName]; 75 $ConfigItem = new $ClassName($this->System); 76 $ConfigItem->Run(); 77 } else $Output = 'Config item '.$ConfigItemName.' not found'; 78 } else $Output = 'Not enough parameters'; 79 return($Output); 80 } 81 } 82 83 class NetworkConfigItem extends Model 84 { 85 function Run() 86 { 50 87 51 88 }
Note:
See TracChangeset
for help on using the changeset viewer.