public static function insertAndGetId($class, $keycol, array $postData = array())
 {
     $obj = new $class();
     $suc = $obj->set_assoc_array($postData);
     if (Master::isLegit($suc)) {
         $where = $obj->get_assoc_array();
         unset($where[$keycol]);
         $clms = array("CLM5" => $keycol);
         $params = array_merge($where, $clms);
         $data = null;
         MyHttpRequest::postTableData($data, "?master={$class}", $postData);
         //print_r($data);
         MyHttpRequest::getJSONTableData($data, "?master={$class}", $params);
         //print_r($data);
         return $data[0][$keycol];
     }
     return false;
 }
<?php

// Check not accessed directly.
if (!isset($post_add)) {
    echo "Are you searching for something? You maybe in wrong place then!!";
    return;
}
$obj = new Attendance_Master();
$suc = $obj->set_assoc_array($_POST);
if (Master::isLegit($suc)) {
    $_POST['syllabus_id'] = MyHttpRequest::insertAndGetId("Syllabus", "syllabus_id", $_POST);
    $_POST['teaches_id'] = MyHttpRequest::insertAndGetId("Teaches", "teaches_id", $_POST);
    require_once "./common.php";
} else {
    echo json_encode($suc);
}
<?php

$right_index = 1;
require_once $dir . "core/modules/authenticate.php";
require_once $dir . "core/modules/update/id.mapping.php";
if (!empty($_GET['id'])) {
    //require_once $dir."core/classes/".$_GET['master'].".class.php";
    $obj = new $_GET['master']();
    //var_dump($obj);
    $postParam = array($id_mapping[$_GET['master']] => $_GET['id']);
    if (MyHttpRequest::getJSONTableData($response, "?master={$_GET['master']}", $postParam)) {
        $suc = $obj->set_assoc_array($response[0], true);
        //var_dump($obj);
        ?>
<h1 class="form_heading purple-gradient">
<?php 
        echo $_GET['act'] . " " . $_GET['master']::HEADING;
        ?>
</h1>
<br>
<?php 
        $myjs_includes[] = "ajax/form";
        $myjs_includes[] = "url_var";
        if (method_exists($obj, 'getUpdateForm')) {
            echo $obj->getUpdateForm($suc);
        } else {
            echo $obj->getHtml($suc);
        }
        $obj->includeJs();
    } else {
        echo HTTP_Status::NOT_FOUND_MSG;
Beispiel #4
0
 function getRelayInfo($ServerDevice, $PK_Device, $SessionToken)
 {
     $url = "https://" . $ServerDevice . "/device/device/device/" . $PK_Device;
     $headers = array();
     $headers[] = 'MMSSession: ' . $SessionToken;
     $req = new MyHttpRequest();
     $data = $req->get($url, $headers);
     $obj = json_decode($data);
     return $obj;
 }