1 | <?php |
||
16 | abstract class AbstractAction { |
||
17 | |||
18 | /** @var string holds the name of the action (lowercase class name, no namespace) */ |
||
19 | protected $actionname; |
||
20 | |||
21 | /** |
||
22 | * AbstractAction constructor. |
||
23 | * |
||
24 | * @param string $actionname the name of this action (see getActionName() for caveats) |
||
25 | */ |
||
26 | public function __construct($actionname = '') { |
||
34 | |||
35 | /** |
||
36 | * Return the minimum permission needed |
||
37 | * |
||
38 | * This needs to return one of the AUTH_* constants. It will be checked against |
||
39 | * the current user and page after checkPermissions() ran through. If it fails, |
||
40 | * the user will be shown the Denied action. |
||
41 | * |
||
42 | * @return int |
||
43 | */ |
||
44 | abstract public function minimumPermission(); |
||
45 | |||
46 | /** |
||
47 | * Check conditions are met to run this action |
||
48 | * |
||
49 | * @throws ActionException |
||
50 | * @return void |
||
51 | */ |
||
52 | public function checkPreconditions() { |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * Process data |
||
57 | * |
||
58 | * This runs before any output is sent to the browser. |
||
59 | * |
||
60 | * Throw an Exception if a different action should be run after this step. |
||
61 | * |
||
62 | * @throws ActionException |
||
63 | * @return void |
||
64 | */ |
||
65 | public function preProcess() { |
||
67 | |||
68 | /** |
||
69 | * Output whatever content is wanted within tpl_content(); |
||
70 | * |
||
71 | * @fixme we may want to return a Ui class here |
||
72 | */ |
||
73 | public function tplContent() { |
||
76 | |||
77 | /** |
||
78 | * Returns the name of this action |
||
79 | * |
||
80 | * This is usually the lowercased class name, but may differ for some actions. |
||
81 | * eg. the export_ modes or for the Plugin action. |
||
82 | * |
||
83 | * @return string |
||
84 | */ |
||
85 | public function getActionName() { |
||
88 | } |
||
89 |