first commit
This commit is contained in:
49
_rejestracja/core/class/ControllerDataExchange.class.php
Normal file
49
_rejestracja/core/class/ControllerDataExchange.class.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/*
|
||||
* Wymiana danych w kontrolerze modułowym
|
||||
*/
|
||||
|
||||
class ControllerDataExchange {
|
||||
|
||||
public static function Get($variable) {
|
||||
$index = self::Init();
|
||||
if(isset($index[$variable])) {
|
||||
return $index[$variable];
|
||||
} else {
|
||||
throw new UserException('Niezdefiniowana zmienna: '.$variable.' w indeksie ControllerDataExchange');
|
||||
}
|
||||
}
|
||||
|
||||
public static function Exists($variable) {
|
||||
$index = self::Init();
|
||||
if(isset($index[$variable])) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function Set($variable, $value) {
|
||||
$index = self::Init();
|
||||
$index[$variable] = $value;
|
||||
self::Save($index);
|
||||
}
|
||||
|
||||
private static function Init() {
|
||||
if(Registry::Exists('ControllerDataExchange')) {
|
||||
return Registry::Get('ControllerDataExchange');
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
private static function Save($index) {
|
||||
if(Registry::Exists('ControllerDataExchange')) {
|
||||
return Registry::Remove('ControllerDataExchange');
|
||||
}
|
||||
|
||||
Registry::Set('ControllerDataExchange', $index);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user