class_mcInputHandler.inc.php
1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
/**
* @copyright (c) 2014, netz.coop eG
*/
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
class mcInputHandler {
public static $ARRAY_PATTERN = '_#_';
private static $action = false;
private static $POST = array();
private static $GET ;
public static function handleGET(array $param_GET) {
if(array_key_exists('action', $param_GET)) {
mcInputHandler::$action = $param_GET['action'];
}
mcInputHandler::$GET = $param_GET;
}
public static function handlePOST(array &$param_POST) {
mcArray::transformArrayWithStringKeyToNormalKey($param_POST, mcInputHandler::$ARRAY_PATTERN);
mcInputHandler::$POST = &$param_POST;
}
public static function &getPOST() {
return mcInputHandler::$POST;
}
public static function getGET() {
return mcInputHandler::$GET;
}
public static function getAction() {
return mcInputHandler::$action;
}
public static function getActionID() {
if(array_key_exists('ID', mcInputHandler::$GET)) {
return mcInputHandler::$GET['ID'];
}
}
public static function getActionMenuLink($param_action, $param_ID=''){
if($param_ID) {
$ID = '&ID='.$param_ID;
} else {
$ID = '';
}
return '?action='.$param_action.$ID;
}
/**
*
* @param type $param_label
* @param type $param_action
* @param type $param_ID
* @return type
*/
public static function getHrefActionMenuLink($param_label, $param_action, $param_ID=''){
return '<a href="'.self::getActionMenuLink($param_action, $param_ID).'">'.$param_label.'</a>';
}
}
?>