|
@@ -21,6 +21,13 @@ class RouteBase {
|
|
|
die("default task not implemented");
|
|
die("default task not implemented");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public function getLink($task = '') {
|
|
|
|
|
+ $clsName = get_class($this);
|
|
|
|
|
+ if ('Route_' != substr($clsName, 0, strlen('Route_'))) throw new Exception("Wrong route class name '{$clsName}'");
|
|
|
|
|
+ $routeName = substr($clsName, strlen('Route_'));
|
|
|
|
|
+ return Request::getPathUri() . "index.php?_route={$routeName}" . (!empty($task) ? "&_task={$task}" : "");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public function runTask($task) {
|
|
public function runTask($task) {
|
|
|
if (empty($task)) throw new Exception("Empty method name");
|
|
if (empty($task)) throw new Exception("Empty method name");
|
|
|
$methodName = "{$task}Action";
|
|
$methodName = "{$task}Action";
|