1 | <?php |
||
17 | class Route { |
||
18 | |||
19 | public $controller = null; |
||
20 | public $action = null; |
||
21 | public $id = null; |
||
22 | public $customFields = []; |
||
23 | |||
24 | public $isBackend = false; |
||
25 | |||
26 | /** |
||
27 | * Constructor that creates Route object from URL request string. |
||
28 | * |
||
29 | * @param string $request URL request string without GET params. |
||
30 | */ |
||
31 | public function __construct($request = "") { |
||
51 | |||
52 | /** |
||
53 | * Detects if current Route controller present in aliases list (used for |
||
54 | * example for Menu functionality). |
||
55 | * |
||
56 | * @param array<string> $aliases List of aliases. |
||
57 | * |
||
58 | * @return bool |
||
59 | */ |
||
60 | public function isOneOf($aliases) { |
||
63 | |||
64 | /** |
||
65 | * Detects current controller action. |
||
66 | * Priority is Request Field value, Route->action field value, $defaultAction. |
||
67 | * |
||
68 | * @param string $actionFieldName $_REQUEST action field name if form was |
||
69 | * submitted (default: 'action'). |
||
70 | * @param string $defaultAction Default action if no action detected |
||
71 | * (default: 'list'). |
||
72 | * |
||
73 | * @return string Action name. |
||
74 | */ |
||
75 | public function getAction($actionFieldName = 'action', $defaultAction = 'list') { |
||
88 | |||
89 | /** |
||
90 | * Generates URL for current Route with action, id and GET params. |
||
91 | * |
||
92 | * @param string $action Action. |
||
93 | * @param mixed $id Id of the record (optional). |
||
94 | * @param array $getParams List of GET params (optional). |
||
95 | * |
||
96 | * @return string URL. |
||
97 | */ |
||
98 | public function getUrl($action = null, $id = null, $getParams = []) { |
||
117 | |||
118 | /** |
||
119 | * Generates default template path for current route. |
||
120 | * |
||
121 | * @return string |
||
122 | */ |
||
123 | public function tplPath() { |
||
131 | |||
132 | } |
||
133 |