-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathorders.php
More file actions
61 lines (54 loc) · 1.9 KB
/
orders.php
File metadata and controls
61 lines (54 loc) · 1.9 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
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
require_once __DIR__ . '/OrderDB.php';
class orders {
public static function export(OrderDB $db) {
$files = $db->getFiles();
foreach ($files as $row) {
$filename = $row['filename'];
if (!file_exists($filename)) {
continue;
}
$content = file_get_contents($filename);
if ($content !== FALSE) {
echo $content;
$language = $row['language'];
switch ($language) {
case 'en':
echo "\nNEXT\n";
break;
default:
echo "\nNAECHSTER\n";
}
}
}
}
public static function list(OrderDB $db) {
$stmt = $db->getRows();
$email = NULL;
$date = NULL;
$filename = NULL;
$status = -1;
$stmt->bindColumn('email', $email, PDO::PARAM_STR);
$stmt->bindColumn('time', $date, PDO::PARAM_STR);
$stmt->bindColumn('filename', $filename, PDO::PARAM_STR);
$stmt->bindColumn('status', $status, PDO::PARAM_INT);
while ($stmt->fetch(PDO::FETCH_BOUND)) {
echo "$status\t$date\t$filename\t$email\n";
}
}
public static function insert(OrderDB $db, DateTimeInterface $time, string $filename, string $lang, string $email = NULL, int $status = 0) {
return $db->addFile($time, $filename, $lang, $email, $status);
}
public static function set_status(OrderDB $db, string $filename, int $status) {
$db->setStatus($filename, $status);
}
public static function select(OrderDB $db) {
$row = $db->selectRow();
return $row;
}
}