-
Notifications
You must be signed in to change notification settings - Fork 0
/
matrixsaveCL.php
65 lines (51 loc) · 1.67 KB
/
matrixsaveCL.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
<?php
require_once('headerDB.inc.php');
if (isset($_POST['listId'])) $values['listId'] = $_POST['listId'];
$effort = 0;
$frequency = 1; // default once a year
$result = query("selectchecklist",$config,$values,$sort);
if (count($result) > 0) {
$res = array();
$res = $result[0];
if (isset($res['frequency']) && $res['frequency'] > 0) $frequency = $res['frequency'];
$values=array(
'listId' => $res['listId'],
'title' => $res['title'],
'categoryId' => $res['categoryId'],
'premiseA' => $res['premiseA'],
'premiseB' => $res['premiseB'],
'conclusion' => $res['conclusion'],
'behaviour' => $res['behaviour'],
'standard' => $res['standard'],
'conditions' => $res['conditions'],
'metaphor' => $res['metaphor'],
'hyperlink' => $res['hyperlink'],
'sortBy' => $res['sortBy'],
'frequency' => $res['frequency'],
'scored' => $res['scored'],
'menu' => $res['menu'],
'prioritise' => $res['prioritise'],
'thrs_score' => $res['thrs_score'],
'thrs_obs' => $res['thrs_obs']
);
} else {
die;
}
if (isset($values['frequency']) && $values['frequency'] > 0) $frequency = $values['frequency'];
$prioritise = $values['prioritise'];
$result1=query("getchecklistitems",$config,$values,$sort);
if (count($result1) > 0) {
foreach ((array) $result1 as $row) if($prioritise == -1 || ($row['priority'] <= $prioritise && $prioritise > -1)) {
$effort += $row['effort'];
}
}
$values['effort'] = ceil($effort * $frequency / 60);
$result = query("updatechecklist",$config,$values,$sort);
//file_put_contents ('a.txt',PHP_EOL . $result . ' x ' . $query, FILE_APPEND);
if (count($result) > 0) {
$i = 1;
} else {
$i = 0;
}
echo json_encode($i);
?>