/**
  * @static
  * @return mixed
  */
 public static function setGlobals()
 {
     $conn = new dbHelper();
     $conn->setSQL("SELECT gl_name, gl_value FROM globals");
     foreach ($conn->execStatement(PDO::FETCH_ASSOC) as $setting) {
         $_SESSION['global_settings'][$setting['gl_name']] = $setting['gl_value'];
     }
     return;
 }
Beispiel #2
0
 /**
  * @param $user_id
  * @return array
  */
 private function getUserPerms($user_id)
 {
     $strSQL = "SELECT * FROM acl_user_perms WHERE user_id = " . floatval($user_id) . " ORDER BY add_date ASC";
     $this->conn->setSQL($strSQL);
     $perms = array();
     foreach ($this->conn->execStatement(PDO::FETCH_ASSOC) as $row) {
         $pK = strtolower($this->getperm_keyFromid($row['perm_id']));
         if ($pK == '') {
             continue;
         }
         if ($row['value'] == '1') {
             $hP = true;
         } else {
             $hP = false;
         }
         $perms[$pK] = array('perm' => $pK, 'inheritted' => false, 'value' => $hP, 'Name' => $this->getperm_nameFromid($row['perm_id']), 'id' => $row['perm_id']);
     }
     return $perms;
 }
Beispiel #3
0
include_once $_SESSION['site']['root'] . "/classes/dbHelper.php";
include_once $_SESSION['site']['root'] . "/repo/global_functions/global_functions.php";
$_SESSION['site']['flops'] = 0;
$mitos_db = new dbHelper();
$data = $_POST;
foreach ($data as $key => $val) {
    if ($val == null) {
        unset($data[$key]);
    }
    if ($val == 'off') {
        $data[$key] = 0;
    }
    if ($val == 'on') {
        $data[$key] = 1;
    }
}
$sql = $mitos_db->sqlBind($data, "form_data_demographics", "I");
$mitos_db->setSQL($sql);
$ret = $mitos_db->execLog();
$pid = $mitos_db->lastInsertId;
$mitos_db->setSQL("SELECT pid, fname, mname, lname\n                     FROM form_data_demographics\n                    WHERE pid = '{$pid}'");
$rows = array();
foreach ($mitos_db->execStatement(PDO::FETCH_ASSOC) as $row) {
    $row['fullname'] = fullname($row['fname'], $row['mname'], $row['lname']);
    array_push($rows, $row);
}
if ($ret[2]) {
    echo '{ success: false, errors: { reason: "' . $ret[2] . '" }}';
} else {
    echo '{ "success": true, "patient": { "pid": "' . $row['pid'] . '", fullname:"' . $row['fullname'] . '" } }';
}
Beispiel #4
0
session_start();
session_cache_limiter('private');
$_SESSION['site']['flops'] = 0;
include_once $_SESSION['site']['root'] . "/classes/dbHelper.php";
$mitos_db = new dbHelper();
$rawData = file_get_contents("php://input");
$foo = json_decode($rawData, true);
$data = $foo['row'];
switch ($_SERVER['REQUEST_METHOD']) {
    case 'GET':
        $mitos_db->setSQL("SELECT gl_name, gl_index, gl_value FROM globals");
        // ****************************************************************************************************
        // $rows = $mitos_db->execStatement(PDO::FETCH_ASSOC) because we wwant to print all recods into one row
        // ****************************************************************************************************
        $rows = array();
        foreach ($mitos_db->execStatement() as $row) {
            $rows['data_id'] = '1';
            $rows[$row[0]] = $row[2];
        }
        print_r(json_encode(array('totals' => '1', 'row' => $rows)));
        exit;
    case 'PUT':
        foreach ($data as $key => $value) {
            //--------------------------------------------------------------------------
            // lets skip data_id, it doesn't exist in the database
            // this id is for ExtJs use only
            //--------------------------------------------------------------------------
            if ($key != 'data_id') {
                //---------------------------------------------------------------------
                // check value is an int and trim it, else dateDecode it
                //---------------------------------------------------------------------
     echo ']}' . chr(13);
     break;
     // *************************************************************************************
     // Create a new list
     // This data creation is special, we don't nee a data_create.ejs.php to do this.
     // *************************************************************************************
 // *************************************************************************************
 // Create a new list
 // This data creation is special, we don't nee a data_create.ejs.php to do this.
 // *************************************************************************************
 case "c_list":
     $mitos_db = new dbHelper();
     // check if this already exists
     $sql = "SELECT count(*) as howmany FROM list_options WHERE title= '" . $_POST['list_name'] . "' OR option_id = '" . strtolower($_POST['option_id']) . "'";
     $mitos_db->setSQL($sql);
     $ret = $mitos_db->execStatement(PDO::FETCH_ASSOC);
     if ($ret[0]['howmany']) {
         echo '{ success: false, errors: { reason: "' . i18n('This record already exists', 'r') . '" }}';
         return;
     }
     // Get last sequence of the list option
     $sql = "SELECT count(seq) as last_seq FROM list_options WHERE list_id = 'lists' ORDER BY title, seq";
     $mitos_db->setSQL($sql);
     $ret = $mitos_db->execStatement(PDO::FETCH_ASSOC);
     $c = $ret[0]['last_seq'] + 1;
     // Finally - Insert the list option
     $sql = "INSERT INTO \n\t\t\t\t\tlist_options \n\t\t\t\tSET \n\t\t\t\t\tlist_id='lists',\n\t\t\t\t\toption_id='" . strtolower($_POST['option_id']) . "',\n\t\t\t\t\ttitle='" . $_POST['list_name'] . "',\n\t\t\t\t\tseq='" . $c . "',\n\t\t\t\t\tis_default='0',\n\t\t\t\t\toption_value='0',\n\t\t\t\t\tmapping='',\n\t\t\t\t\tnotes=''";
     $mitos_db->setSQL($sql);
     $ret = $mitos_db->execLog();
     if ($ret == "") {
         echo '{ success: false, errors: { reason: "' . $ret[2] . '" }}';
//--------------------------------------------------------------------------------
$mitos_db = new dbHelper();
//--------------------------------------------------------------------------------
// always echo the first display Field (Fees)
//--------------------------------------------------------------------------------
echo "{ width: 70, xtype: 'displayfield', value: '";
echo i18n('Fees');
echo ": '}";
//**********************************************************************************************************************
// look for pricelevel lists from list_options table
//**********************************************************************************************************************
$mitos_db->setSQL("SELECT option_id, title\n                     FROM list_options\n                    WHERE list_id = 'pricelevel'\n                 ORDER BY seq");
//--------------------------------------------------------------------------------
// echo the fields
//--------------------------------------------------------------------------------
foreach ($mitos_db->execStatement(PDO::FETCH_ASSOC) as $fee) {
    echo ",{ width: 100, xtype: 'textfield', name: 'fee_" . $fee['option_id'] . "', emptyText: '";
    echo i18n($fee['title']);
    echo "'}";
}
//**********************************************************************************************************************
// look for te taxes fields
//**********************************************************************************************************************
$mitos_db->setSQL("SELECT option_id, title\n                     FROM list_options\n                    WHERE list_id = 'taxrate'\n                 ORDER BY seq");
$total = $mitos_db->rowCount();
//--------------------------------------------------------------------------------
// if a tax field fond - echo the "Taxes" display field and the fields
//--------------------------------------------------------------------------------
if ($total > 0) {
    echo ",{ width: 70, xtype: 'displayfield', value: '";
    echo i18n('Taxes');
<?php

//--------------------------------------------------------------------------------------
// Database class instance
//--------------------------------------------------------------------------------------
$mitos_db = new dbHelper();
//--------------------------------------------------------------------------------------
// Lets pull the data from globals table and settings the $_SESSION['global_settings'] values
//--------------------------------------------------------------------------------------
$mitos_db->setSQL("SELECT gl_name, gl_value FROM globals");
foreach ($mitos_db->execStatement(PDO::FETCH_ASSOC) as $setting) {
    $_SESSION['global_settings'][$setting['gl_name']] = $setting['gl_value'];
}