| 1 | <?php | 
| 2 |  | 
| 3 | require_once("YakkaObject.php"); | 
| 4 |  | 
| 5 | class YakkaRole extends YakkaObject { | 
| 6 | var $userStorage; | 
| 7 |  | 
| 8 | var $exists; | 
| 9 |  | 
| 10 | var $name; | 
| 11 | var $comment; | 
| 12 |  | 
| 13 | function YakkaRole($id = null) { | 
| 14 | $$singleton = YAKKA_GLOBAL_SINGLETON; | 
| 15 | global $singleton; | 
| 16 | $this->userStorage = &$singleton->userStorage; | 
| 17 |  | 
| 18 | $this->YakkaObject($id); | 
| 19 |  | 
| 20 | $this->exists = $this->load($id); | 
| 21 | } | 
| 22 |  | 
| 23 | function load($id) { | 
| 24 | if ($data = $this->userStorage->loadRole($id)) { | 
| 25 | $this->id = $data["id"]; | 
| 26 | $this->name = $data["name"]; | 
| 27 | $this->comment = $data["comment"]; | 
| 28 |  | 
| 29 | $this->exists = true; | 
| 30 | } else { | 
| 31 | $this->id = $id; | 
| 32 | $this->exists = false; | 
| 33 | } | 
| 34 |  | 
| 35 | return $this->exists; | 
| 36 | } | 
| 37 | } | 
| 38 |  | 
| 39 | ?> |