aboutsummaryrefslogtreecommitdiff
path: root/app/class/route.php
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2018-11-11 17:19:26 +0100
committervincent-peugnet <v.peugnet@free.fr>2018-11-11 17:19:26 +0100
commitd7f3313ff4514e38c9f53439cd1a1287e56e45f7 (patch)
treeabff39ab11cb317f5fcd2db558da1c59bdae9239 /app/class/route.php
parent2f363e8fa26ab849539e64ff7caa21bd164e8979 (diff)
downloadwcms-d7f3313ff4514e38c9f53439cd1a1287e56e45f7.tar.gz
wcms-d7f3313ff4514e38c9f53439cd1a1287e56e45f7.zip
reboot folder
Diffstat (limited to 'app/class/route.php')
-rw-r--r--app/class/route.php84
1 files changed, 84 insertions, 0 deletions
diff --git a/app/class/route.php b/app/class/route.php
new file mode 100644
index 0000000..cc2fe59
--- /dev/null
+++ b/app/class/route.php
@@ -0,0 +1,84 @@
+<?php
+
+class Route
+{
+ protected $id = null;
+ protected $aff = null;
+ protected $action = null;
+ protected $redirect = null;
+
+ const AFF = ['read', 'edit', 'admin', 'media'];
+
+ public function __construct($vars)
+ {
+ $this->hydrate($vars);
+ }
+
+ public function hydrate($vars)
+ {
+ foreach ($vars as $var => $value) {
+ $method = 'set' . $var;
+ if (method_exists($this, $method)) {
+ $this->$method($value);
+ }
+ }
+ }
+
+ public function toarray()
+ {
+ $array = [];
+ if (!empty($this->id)) {
+ $array[] = 'art';
+ }
+ if (!empty($this->aff)) {
+ $array[] = 'aff='.$this->aff;
+ }
+ if (!empty($this->action)) {
+ $array[] = 'action=' . $this->action;
+ }
+ if (!empty($this->redirect)) {
+ $array[] = $this->redirect;
+ }
+
+
+ return $array;
+ }
+
+ function tostring()
+ {
+ return implode(' ', $this->toarray());
+ }
+
+
+
+ public function setid($id)
+ {
+ $this->id = $id;
+ }
+
+ public function setaff($aff)
+ {
+ $this->aff = $aff;
+
+ }
+
+ public function setaction($action)
+ {
+ $this->action = $action;
+ }
+
+ public function setredirect($redirect)
+ {
+ $this->redirect = $redirect;
+ }
+
+ public function id()
+ {
+ return $this->id;
+ }
+}
+
+
+
+
+?> \ No newline at end of file