Spaces:
Sleeping
Sleeping
File size: 2,185 Bytes
07c3cdd | 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
require_once ("classes/model/Configuration.php");
$option = (isset($_POST["option"]))? $_POST["option"] : null;
$response = array();
switch ($option) {
case "SETUP":
$swInternetConnection = intval($_POST["internetConnection"]);
$status = 1;
try {
$confEeUid = "enterpriseConfiguration";
$criteria = new Criteria("workflow");
$criteria->addSelectColumn(ConfigurationPeer::CFG_VALUE);
$criteria->add(ConfigurationPeer::CFG_UID, "EE");
$criteria->add(ConfigurationPeer::OBJ_UID, $confEeUid);
$rsCriteria = ConfigurationPeer::doSelectRS($criteria);
if ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$data = unserialize($row[0]);
$data["internetConnection"] = $swInternetConnection;
//Update values
$criteria1 = new Criteria("workflow");
$criteria1->add(ConfigurationPeer::CFG_UID, "EE");
$criteria1->add(ConfigurationPeer::OBJ_UID, $confEeUid);
//Update set
$criteria2 = new Criteria("workflow");
$criteria2->add(ConfigurationPeer::CFG_VALUE, serialize($data));
BasePeer::doUpdate($criteria1, $criteria2, Propel::getConnection("workflow"));
} else {
$conf = new Configuration();
$data = array("internetConnection" => $swInternetConnection);
$conf->create(
array(
"CFG_UID" => "EE",
"OBJ_UID" => $confEeUid,
"CFG_VALUE" => serialize($data),
"PRO_UID" => "",
"USR_UID" => "",
"APP_UID" => ""
)
);
}
$response["status"] = "OK";
} catch (Exception $e) {
$response["message"] = $e->getMessage();
$status = 0;
}
if ($status == 0) {
$response["status"] = "ERROR";
}
break;
}
echo G::json_encode($response);
|