-
Notifications
You must be signed in to change notification settings - Fork 0
/
SetActiveModels.php
36 lines (34 loc) · 988 Bytes
/
SetActiveModels.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
<?php
define('NOAUTHENTICATION',true);
include_once('../global.php');
global $dbh;
error_log("SetActiveModels.php");
$selectedmodels = $_POST['selectedscheduledmodel'];
$action = $_POST['action'];
$userid = $_POST['userid'];
error_log(print_r($selectedmodels, true));
error_log($action);
foreach ($selectedmodels as $selectedmodel){
$selectedmodel2 = str_replace('SM', '', $selectedmodel);
error_log($selectedmodel2);
if ($action == 'deactivate'){
$move = pg_query_params($dbh,'UPDATE scheduledruns
SET active = false
WHERE id = $1',
array ($selectedmodel2));
pg_free_result($move);
}
else{
$move = pg_query_params($dbh,'UPDATE scheduledruns
SET active = true
WHERE id = $1',
array ($selectedmodel2));
pg_free_result($move);
}
}
$result = pg_query_params ($dbh, 'select models.getscheduledmodelnames($1);',
array ($userid));
$scheduledruns = pg_fetch_all($result);
pg_free_result($result);
echo (json_encode($scheduledruns));
?>