'/', 'msg' => ERR_NEED_ID); // include ("includes/show-error.php"); } // 01. GET DATA NEEDED --------------------------------------------------------- // * Load Parametres, Session and Functions; // * Check User Permitions // * Check Script Call //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// // get totals of categories // --------------------------------------------------------------------------- $totals = get_totals(); // read fields options (json format) // --------------------------------------------------------------------------- $formARRAY = json_decode(FORMJSON); // get item record // --------------------------------------------------------------------------- // init database connection $_dbc = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_DBMS); if ($_dbc->connect_errno) { echo "Database connection failed; Please try in a few minutes. "; if (TESTING) echo $_dbc->connect_error; $_dbc->close(); die(); } $_dbc->set_charset("utf8"); // prepare statemet $_stm = $_dbc->prepare("SELECT identity, operator, `timestamp`, record FROM items WHERE id = ?"); $_stm->bind_param("d", $item_id); // bind values $_stm->execute(); // execute query $_stm->store_result(); // store result if ($_stm->num_rows) { $_stm->bind_result($idnt, $opr, $tm, $serREC); // bind result variables $_stm->fetch(); // fetch FIRST record values // unserialize main record to variable $record = unserialize($serREC); // edit record $record['id'] = $item_id; $record['identity'] = $idnt; $record['operator'] = $opr; $record['itemid'] = end(explode('.', $idnt)); $record['totalitems'] = $totals[$record['ccode']]; date_default_timezone_set('Europe/Athens'); setlocale(LC_ALL, 'el_GR.UTF-8', 'grc'); $record['timestamp'] = local_dt($tm); } else { return array('success' => false, 'data' => "No items found"); // return error(s) } $_stm->close(); // close statement $_dbc->close(); // close connection // 02. RENDER HTML and DATA ---------------------------------------------------- // * Draw fileds from Json Array per section // * Prepare JS needed // * Put data from Record // * Generate JS (prepared + static) // --- // Script is based on on ui-new-item.php // More information about the script workflow can be found there. //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// // Init strigns for JS generator (needed to handle everything) /////////////// // --------------------------------------------------------------------------- $checkFilledJS = ""; // JS for checking empty fields $ref2Select2JS = ""; // references to Select2-controls Javascript $initSelectsJS = ""; // js to initialize select fields (single or multiple) // --- depricated (added static into js) : $addJSreadonly = ""; // js to add readonly fields and their values to port-object ?>