00001 <?php
00014 class SEventHandler extends SObject {
00016 private $permission;
00017
00018 public function doc() {
00019 return "This class takes action based on event objects"
00020 . " that are passed to it.";
00021 }
00022
00037 public function handleEvent($e) {
00038
00039 $p = $this->getPermission();
00040
00041
00042 if (!$p->checkPermission($e)) {
00043
00044 global $prm, $SWAT;
00045 $prm->getErrorFrom($p);
00046 $prm->getWarningFrom($p);
00047
00048 if (($SWAT != null) && ($SWAT->getGlobalUser() instanceof SUser)){
00049 $SWAT->getGlobalUser()->setFlash("You don't have permission to perform the requested action.");
00050 }
00051 $this->setPrettyWarning('handleEvent',
00052 "You don't have permission to perform the requested action.");
00053 return false;
00054 }
00055
00056
00057
00058
00059 return true;
00060 }
00061
00072 public function setPermission($p) {
00073 $this->permission = $p;
00074 }
00075
00081 public function getPermission() {
00082 if ($this->permission == null) {
00083 $this->permission = new SPermission();
00084 }
00085 return $this->permission;
00086 }
00087 }
00088 ?>