submodule = $submodule; } public function __set($name, $value) { $this->submodule->$name = $value; } public function __get($name) { return $this->submodule->$name; } public function __call($name, $args) { if($this->cache !== false && in_array($name, array( 'addRecord', 'editRecord', 'deleteRecord', 'terminateZone', 'activateZone' ))) { $this->cache->remove(); } return call_user_func_array(array($this->submodule,$name), $args);//$this->submodule->$name($args[0]); } public function enableCache($serverid, $domain) { $this->cache = CacheFactory::get("{$serverid}_{$domain}.cache"); } public function getRecords($recordType = false) { if($recordType === false && $this->cache !== false && $this->cache->exist()) { return $this->cache->get(); } $records = $this->submodule->getRecords($recordType); if($this->cache !== false) { $this->cache->save($records); } return $records; } public function moduleHasMethod($methodName) { return method_exists($this->submodule, $methodName); } public function moduleConvertInputFormData(&$input) { if($this->moduleHasMethod('convertInputFormData')) { $this->submodule->convertInputFormData($input); } } public function removeDefaultServerRecords($defaultModuleRecords) { if($this->submodule->isRemoveableDefaultServerRecordsSet()) { $this->submodule->removeDefaultServerRecordsSet($defaultModuleRecords); } } public function customEditRecords($input) { if($this->submodule->hasCustomEditRecords()) { return $this->submodule->customEditRecords($input); } return false; } public function getSubmodule() { return $this->submodule; } }