-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPromout.php
executable file
·128 lines (115 loc) · 2.54 KB
/
Promout.php
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
/**
* Action Promout
*
* Checkout of prom with :id
*
* @link http://getfrapi.com
* @author Frapi <[email protected]>
* @link /promout/:id
*/
class Action_Promout extends Frapi_Action implements Frapi_Action_Interface
{
/**
* Required parameters
*
* @var An array of required parameters.
*/
protected $requiredParams = array();
/**
* The data container to use in toArray()
*
* @var A container of data to fill and return in toArray()
*/
private $data = array();
/**
* To Array
*
* This method returns the value found in the database
* into an associative array.
*
* @return array
*/
public function toArray()
{
return $this->data;
}
/**
* Default Call Method
*
* This method is called when no specific request handler has been found
*
* @return array
*/
public function executeAction()
{
return $this->toArray();
}
/**
* Get Request Handler
*
* This method is called when a request is a GET
*
* @return array
*/
public function executeGet()
{
return $this->toArray();
}
/**
* Post Request Handler
*
* This method is called when a request is a POST
*
* @return array
*/
public function executePost()
{
$db = Frapi_Database::getInstance();
$id = $this->getParam('id');
$chckin = date('Y-m-d H:i:s');
if($db->exec("UPDATE tbl_tickets SET prom_checkout = '".$chckin."' WHERE id='".$id."'")){
$results = $db->query("SELECT * FROM tbl_tickets WHERE id='".$id."'");
foreach($results as $row){
$this->data['name'] = $row['name'];
}
$this->data['success']=1;
} else {
$this->data['success']=0;
}
return $this->toArray();
}
/**
* Put Request Handler
*
* This method is called when a request is a PUT
*
* @return array
*/
public function executePut()
{
return $this->toArray();
}
/**
* Delete Request Handler
*
* This method is called when a request is a DELETE
*
* @return array
*/
public function executeDelete()
{
return $this->toArray();
}
/**
* Head Request Handler
*
* This method is called when a request is a HEAD
*
* @return array
*/
public function executeHead()
{
return $this->toArray();
}
}