Exemplo n.º 1
0
 public function logoutInactiveUsers()
 {
     $now = time();
     $foo = $now - $_SESSION['inactive']['time'];
     $users = array();
     $this->db->setSQL("SELECT id, uid FROM users_sessions WHERE last_request < {$foo} AND logout IS NULL");
     foreach ($this->db->fetchRecords(PDO::FETCH_ASSOC) as $user) {
         $id = $user['id'];
         $users[] = array('uid' => $user['uid']);
         $this->db->setSQL("UPDATE users_sessions SET logout = '{$now}' WHERE id = '{$id}'");
         $this->db->execOnly();
     }
     return $users;
 }
Exemplo n.º 2
0
 public function getTemplatesTypes()
 {
     $this->db->setSQL("SELECT DISTINCT title, body\n                           \t FROM documents_templates\n                           \t WHERE template_type ='documenttemplate'");
     $records = $this->db->fetchRecords(PDO::FETCH_ASSOC);
     $records[] = array('title' => 'Empty');
     return $records;
 }
Exemplo n.º 3
0
 public function getPatientFutureEventsByPid($pid)
 {
     $date = Time::getLocalTime();
     $tomorrow = date('Y-m-d 0000:00:00', strtotime($date . ' + 1 days'));
     $this->db->setSQL("SELECT * FROM calendar_events WHERE patient_id = '{$pid}' AND start >= '{$tomorrow}'");
     return $this->db->fetchRecords(PDO::FETCH_ASSOC);
 }
Exemplo n.º 4
0
 /**
  * Function: getPatientBalanceByPid
  */
 public function getPatientBalanceByPid($pid)
 {
     // Declare all the variables that we are gone to use.
     (array) ($balance_total = '');
     $this->db->setSQL("SELECT SUM(amount) as balance FROM payment_transactions WHERE payer_id = '{$pid}'");
     $balance_total = $this->db->fetchRecord();
     return $balance_total['balance'];
 }
Exemplo n.º 5
0
 public function getLabsLiveSearch(stdClass $params)
 {
     $this->db->setSQL("SELECT id,\n\t\t\t\t\t\t\t\t  parent_loinc,\n\t\t\t\t\t\t\t\t  loinc_number,\n\t\t\t\t\t\t\t\t  loinc_name\n\t\t\t\t\t\t\tFROM  labs_panels\n\t\t\t\t\t\t\tWHERE parent_loinc <> loinc_number\n\t\t\t\t\t\t\t  AND loinc_name      LIKE'{$params->query}%'");
     $records = $this->db->fetchRecords(PDO::FETCH_ASSOC);
     $total = count($records);
     $records = array_slice($records, $params->start, $params->limit);
     return array('totals' => $total, 'rows' => $records);
 }
Exemplo n.º 6
0
 public function updatePatientDisclosure(stdClass $params)
 {
     $data = get_object_vars($params);
     unset($data['id']);
     $this->db->setSQL($this->db->sqlBind($data, 'patient_disclosures', 'U', array('id' => $params->id)));
     $this->db->execLog();
     return $params;
 }
Exemplo n.º 7
0
 public function updatePreventiveCareDismissedAlertsByPid(stdClass $params)
 {
     $data = get_object_vars($params);
     unset($data['id'], $data['description']);
     $this->db->setSQL($this->db->sqlBind($data, 'preventive_care_inactive_patient', 'U', array('id' => $params->id)));
     $this->db->execLog();
     return $params;
 }
Exemplo n.º 8
0
 public function updateDocumentsTitle(stdClass $params)
 {
     $data = get_object_vars($params);
     $id = $data['id'];
     unset($data['id'], $data['date']);
     $this->db->setSQL($this->db->sqlBind($data, 'patient_documents', 'U', array('id' => $id)));
     $this->db->execLog();
     return $params;
 }
Exemplo n.º 9
0
 public function getMedicationAttributesByCODE($CODE)
 {
     $this->db->setSQL("\n            SELECT `ATV`, `ATN` FROM rxnsat WHERE `CODE` = '{$CODE}' AND `ATN` = 'DST' AND `SAB` = 'MMSL'\n            UNION\n            SELECT `ATV`, `ATN` FROM rxnsat WHERE `CODE` = '{$CODE}' AND `ATN` = 'DRT' AND `SAB` = 'MMSL'\n            UNION\n            SELECT `ATV`, `ATN` FROM rxnsat WHERE `CODE` = '{$CODE}' AND `ATN` = 'DDF' AND `SAB` = 'MMSL'\n        ");
     $foo = array();
     foreach ($this->db->fetchRecords(PDO::FETCH_ASSOC) as $fo) {
         $foo[$fo['ATN']] = $fo['ATV'];
     }
     return $foo;
 }
Exemplo n.º 10
0
 /**
  * @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;
 }
Exemplo n.º 11
0
 public function logEmergency()
 {
     $data['pid'] = $this->pid;
     $data['eid'] = $this->eid;
     $data['uid'] = $_SESSION['user']['id'];
     $data['date_created'] = Time::getLocalTime();
     $this->db->setSQL($this->db->sqlBind($data, 'emergencies', 'I'));
     $this->db->execLog();
     $this->emergencyId = $this->db->lastInsertId;
 }
Exemplo n.º 12
0
 /**
  * @param stdClass $params
  * @return stdClass
  * NOTES: Update contact address to who?
  * Naming: "updatePatientAddress"
  */
 public function updateAddress(stdClass $params)
 {
     $data = get_object_vars($params);
     unset($data['id'], $data['fullname'], $data['fulladdress']);
     $sql = $this->db->sqlBind($data, "users", "U", "id='" . $params->id . "'");
     $this->db->setSQL($sql);
     $this->db->execLog();
     $params->fullname = Person::fullname($params->fname, $params->mname, $params->lname);
     $params->fulladdress = Person::fulladdress($params->street, $params->streetb, $params->city, $params->state, $params->zip);
     return $params;
 }
Exemplo n.º 13
0
 /**
  * @static
  * @return mixed
  */
 public static function setGlobals()
 {
     $conn = new dbHelper();
     $conn->setSQL("SELECT gl_name, gl_value FROM globals");
     foreach ($conn->fetchRecords(PDO::FETCH_ASSOC) as $setting) {
         $_SESSION['global_settings'][$setting['gl_name']] = $setting['gl_value'];
     }
     $_SESSION['global_settings']['timezone_offset'] = -14400;
     $_SESSION['global_settings']['date_time_display_format'] = $_SESSION['global_settings']['date_display_format'] . ' ' . $_SESSION['global_settings']['time_display_format'];
     return $_SESSION['site']['path'];
 }
Exemplo n.º 14
0
 public function removeAllowBlank($table)
 {
     $this->db->setSQL("Select id, options FROM {$table}");
     foreach ($this->db->fetchRecords(PDO::FETCH_ASSOC) as $row) {
         $options = json_decode($row['options'], true);
         if (isset($options['allowBlank'])) {
             unset($options['allowBlank']);
             $id = $row['id'];
             $data['options'] = json_encode($options);
             $this->db->setSQL($this->db->sqlBind($data, $table, 'U', "id='{$id}'"));
             $this->db->execOnly();
         }
     }
 }
Exemplo n.º 15
0
 function getItemsOptions($item_id)
 {
     $foo = array();
     $this->db->setSQL("Select options FROM forms_field_options WHERE field_id = '{$item_id}'");
     $options = $this->db->fetchRecord();
     $options = json_decode($options['options'], true);
     foreach ($options as $option => $value) {
         $foo[$option] = $value;
         if ($value == 'temp_f' || $value == 'temp_c' || $value == 'weight_lbs' || $value == 'weight_kg' || $value == 'height_cm' || $value == 'height_in' || $value == 'head_circumference_cm' || $value == 'head_circumference_in' || $value == 'waist_circumference_cm' || $value == 'waist_circumference_in') {
             $foo['enableKeyEvents'] = true;
         }
     }
     return $foo;
 }
Exemplo n.º 16
0
 private function getGraphCurves($type, $sex)
 {
     $this->db->setSQL("SELECT * FROM vector_graphs WHERE type = '{$type}' AND sex = '{$sex}'");
     $records = array();
     foreach ($this->db->fetchRecords(PDO::FETCH_ASSOC) as $row) {
         unset($row['type'], $row['sex'], $row['L'], $row['M'], $row['S']);
         foreach ($row as $key => $val) {
             if ($val == null) {
                 unset($row[$key]);
             }
         }
         $records[] = $row;
     }
     return $records;
 }
Exemplo n.º 17
0
 /**
  * @internal param $user_id
  * @return array
  */
 public function getUserPerms()
 {
     $this->conn->setSQL("SELECT * FROM acl_user_perms WHERE user_id = '{$this->user_id}' ORDER BY add_date ASC");
     $perms = array();
     foreach ($this->conn->fetchRecords(PDO::FETCH_ASSOC) as $row) {
         $pK = strtolower($row['perm_key']);
         if ($pK == '') {
             continue;
         }
         if ($row['value'] == '1') {
             $hP = true;
         } else {
             $hP = false;
         }
         $perms[$pK] = array('perm' => $pK, 'inheritted' => false, 'value' => $hP, 'Name' => $this->getPermNameByPermKey($row['perm_key']), 'id' => $row['id']);
     }
     return $perms;
 }
Exemplo n.º 18
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;
 }
Exemplo n.º 19
0
$row['state'] = dataEncode($data['state']);
$row['zip'] = dataEncode($data['zip']);
// secondary address
$row['street2'] = dataEncode($data['street2']);
$row['streetb2'] = dataEncode($data['streetb2']);
$row['city2'] = dataEncode($data['city2']);
$row['state2'] = dataEncode($data['state2']);
$row['zip2'] = dataEncode($data['zip2']);
// phones
$row['phone'] = dataEncode($data['phone']);
$row['phonew1'] = dataEncode($data['phonew1']);
$row['phonew2'] = dataEncode($data['phonew2']);
$row['phonecell'] = dataEncode($data['phonecell']);
$row['fax'] = dataEncode($data['fax']);
//additional info
$row['email'] = dataEncode($data['email']);
$row['assistant'] = dataEncode($data['assistant']);
$row['url'] = dataEncode($data['url']);
$row['upin'] = dataEncode($data['upin']);
$row['npi'] = dataEncode($data['npi']);
$row['federaltaxid'] = dataEncode($data['federaltaxid']);
$row['taxonomy'] = dataEncode($data['taxonomy']);
$row['notes'] = dataEncode($data['notes']);
// *************************************************************************************
// Finally that validated POST variables is inserted to the database
// This one make the JOB of two, if it has an ID key run the UPDATE statement
// if not run the INSERT stament
// *************************************************************************************
$mitos_db->setSQL("INSERT INTO users \n     \t\t\t      SET username          = '******', " . "\n\t\t\t\t          password          = '******', " . "\n\t\t\t\t          abook_type        = '" . $row['abook_type'] . "', " . "\n\t\t\t\t          title             = '" . $row['title'] . "', " . "\n\t\t\t\t          fname             = '" . $row['fname'] . "', " . "\n\t\t\t\t          mname             = '" . $row['mname'] . "', " . "\n\t\t\t\t          lname             = '" . $row['lname'] . "', " . "\n\t\t\t\t          specialty         = '" . $row['specialty'] . "', " . "\n\t\t\t\t          organization      = '" . $row['organization'] . "', " . "\n\t\t\t\t          valedictory       = '" . $row['valedictory'] . "', " . "\n\t\t\t\t          street            = '" . $row['street'] . "', " . "\n\t\t\t\t          streetb           = '" . $row['streetb'] . "', " . "\n\t\t\t\t          city              = '" . $row['city'] . "', " . "\n\t\t\t\t          state             = '" . $row['state'] . "', " . "\n\t\t\t\t          zip               = '" . $row['zip'] . "', " . "\n\t\t\t\t          street2           = '" . $row['street2'] . "', " . "\n\t\t\t\t          streetb2          = '" . $row['streetb2'] . "', " . "\n\t\t\t\t          city2             = '" . $row['city2'] . "', " . "\n\t\t\t\t          state2            = '" . $row['state2'] . "', " . "\n\t\t\t\t          zip2              = '" . $row['zip2'] . "', " . "\n\t\t\t\t          phone             = '" . $row['phone'] . "', " . "\n\t\t\t\t          phonew1           = '" . $row['phonew1'] . "', " . "\n\t\t\t\t          phonew2           = '" . $row['phonew2'] . "', " . "\n\t\t\t\t          phonecell         = '" . $row['phonecell'] . "', " . "\n\t\t\t\t          fax               = '" . $row['fax'] . "', " . "\n\t\t\t\t          email             = '" . $row['email'] . "', " . "\n\t\t\t\t          assistant         = '" . $row['assistant'] . "', " . "\n\t\t\t\t          url               = '" . $row['url'] . "', " . "\n\t\t\t\t          upin              = '" . $row['upin'] . "', " . "\n\t\t\t\t          npi               = '" . $row['npi'] . "', " . "\n\t\t\t\t          federaltaxid      = '" . $row['federaltaxid'] . "', " . "\n\t\t\t\t          taxonomy          = '" . $row['taxonomy'] . "', " . "\n\t\t\t\t          notes             = '" . $row['notes'] . "'");
$mitos_db->execLog();
echo "{ success: true }";
//--------------------------------------------------------------------------------------------------------------------------
// listOrganization.json.php
//
// v0.0.1
// Under GPLv3 License
//
// Integrated by: Gi Technologies. in 2011
//
// Remember, this file is called via the Framework Store, this is the AJAX thing.
//--------------------------------------------------------------------------------------------------------------------------
session_name("MitosEHR");
session_start();
session_cache_limiter('private');
include_once $_SESSION['site']['root'] . "/classes/dbHelper.php";
// **************************************************************************************
// Reset session count 10 secs = 1 Flop
// **************************************************************************************
$_SESSION['site']['flops'] = 0;
// **************************************************************************************
// Database class instance
// **************************************************************************************
$mitos_db = new dbHelper();
$mitos_db->setSQL("SELECT \n\t\t\t\t\t\t*\n\t\t\t\t\tFROM\n  \t\t\t\t\t\tusers\n\t\t\t\t\tHAVING\n  \t\t\t\t\t\torganization <> ''");
$total = $mitos_db->rowCount();
$rows = array();
foreach ($mitos_db->execStatement(PDO::FETCH_ASSOC) as $row) {
    $row['cName'] = $row['fname'] . " " . $row['mname'] . " " . $row['lname'];
    array_push($rows, $row);
}
print json_encode(array('totals' => $total, 'row' => $rows));
Exemplo n.º 21
0
 /**
  * @return array
  */
 public function getCptUsedByClinic()
 {
     $this->db->setSQL("SELECT DISTINCT cpt.code, cpt.code_text, cpt.code_text_medium, cpt.code_text_short\n                             FROM encounter_codes_cpt AS ecc\n                        left JOIN cpt_codes AS cpt ON ecc.code = cpt.code\n                         ORDER BY cpt.code DESC");
     $records = $this->db->fetchRecords(PDO::FETCH_ASSOC);
     return array('totals' => count($records), 'rows' => $records);
 }
Exemplo n.º 22
0
            } elseif ($option['ovalue'] == 'true') {
                // if the sring is true let change the value to a bool
                $option['ovalue'] = true;
            } elseif ($option['ovalue'] == 'false') {
                // if the sring is false let change the value to a bool
                $option['ovalue'] = false;
            }
            $foo[$option['oname']] = $option['ovalue'];
        }
        return $foo;
    }
    $tree = getFileds($formPanel);
    print json_encode(array('text' => '.', 'children' => $tree));
} elseif ($_REQUEST['task'] == 'optionsRequest') {
    $currList = $_REQUEST["list_id"];
    $mitos_db->setSQL("SELECT * FROM list_options WHERE list_id = '{$currList}' ORDER BY seq");
    $total = $mitos_db->rowCount();
    $rows = array();
    foreach ($mitos_db->execStatement(PDO::FETCH_ASSOC) as $row) {
        array_push($rows, $row);
    }
    print_r(json_encode(array('totals' => $total, 'row' => $rows)));
} elseif ($_REQUEST['task'] == 'formRequest') {
    /**
     * This will handle the New item Request where fiels id is not set
     * to handle the update please go to the "else" statement after
     */
    if ($_REQUEST['id'] == null) {
        /**
         * This will handle the new field
         */
Exemplo n.º 23
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'] . '" } }';
}
Exemplo n.º 24
0
//	    }
//	}
//}
$filename = 'cdt.txt';
$handle = fopen($filename, 'r');
$string = fread($handle, filesize($filename));
//preg_match("/(\w*?) (.*\n)/", $string, $matches, PREG_OFFSET_CAPTURE);
//
//print '<pre>';
//print_r($matches);
//
//$html = "<b>bold text</b><a href=howdy.html>click me</a>";
preg_match_all("/(.*?) (.*)\n/", $string, $matches, PREG_SET_ORDER);
foreach ($matches as $val) {
    $data = array('code' => $val[1], 'text' => $val[2]);
    $db->setSQL($db->sqlBind($data, 'cdt_codes', 'I'));
    $db->execOnly();
}
//    print_r($res);
//foreach($res as $num => $val){
//    echo '<pre>';
//    if(is_odd($num)){
//        foreach($res[$num] as $item => $inside){
//        //$surgeries=($inside);
//            $data['surgeries'] = $inside;
//
//           print $db->sqlBind($data, 'table_example', 'I');
//           echo '<br>';
////        $sql=  "INSERT INTO surgeries (type, surgery, type_num) VALUES('".$tittle."','".$surgeries."','".$type_num."')";
////
////            	mysql_query($sql);
Exemplo n.º 25
0
$file_handle = fopen("icds.txt", "r");
while (!feof($file_handle)) {
    $line = fgets($file_handle);
    $data = array();
    $foo = explode("\t", $line);
    $data['id'] = $foo[0];
    $data['parent_id'] = $foo[1];
    $data['code_text'] = $foo[2];
    $data['code_text_short'] = $foo[3];
    $data['code'] = $foo[4];
    $data['digits'] = $foo[5];
    $data['sequence'] = $foo[6];
    $data['category_range'] = $foo[7];
    $data['billing_status'] = $foo[8];
    $data['status'] = $foo[9];
    $data['is_custom_code'] = $foo[10];
    //    $data['doc_url3'] = $foo[11];
    //    $data['r'] = $foo[12];
    //    $data['s'] = $foo[13];
    //    $data['t'] = $foo[14];
    //    $data['u'] = $foo[15];
    //    $data['v'] = $foo[16];
    //    $data['w'] = $foo[17];
    //    $data['x'] = $foo[18];
    $db->setSQL($db->sqlBind($data, 'codes_icds', 'I'));
    $db->execOnly();
}
if (feof($file_handle)) {
    print 'The End!';
}
fclose($file_handle);
Exemplo n.º 26
0
//--------------------------------------------------------------------------------------------------------------------------
session_name("MitosEHR");
session_start();
session_cache_limiter('private');
include_once $_SESSION['site']['root'] . "/classes/dbHelper.php";
require_once $_SESSION['site']['root'] . "/classes/AES.php";
//******************************************************************************
// Reset session count 10 secs = 1 Flop
//******************************************************************************
$_SESSION['site']['flops'] = 0;
//------------------------------------------
// Database class instance
//------------------------------------------
$mitos_db = new dbHelper();
$WHERE = $_REQUEST["show"] == "active" ? "WHERE activity = 1" : "";
// Setting defults incase no request is sent by sencha
$start = $_REQUEST["start"] == null ? 0 : $_REQUEST["start"];
$limit = $_REQUEST["limit"] == null ? 10 : $_REQUEST["limit"];
$facillity = $_REQUEST["facillity"];
$mitos_db->setSQL("SELECT id FROM onotes " . $WHERE . " ORDER BY date DESC");
$total = $mitos_db->rowCount();
$mitos_db->setSQL("SELECT * FROM onotes " . $WHERE . " ORDER BY date DESC\n        \t\t\tLIMIT " . $start . "," . $limit);
//	WHERE onotes.facillity = '$facillity'
$rows = array();
foreach ($mitos_db->execStatement(PDO::FETCH_ASSOC) as $row) {
    array_push($rows, $row);
}
//------------------------------------------------------------------------------
// here we are adding "totals" and the root "row" for sencha use
//------------------------------------------------------------------------------
print_r(json_encode(array('totals' => $total, 'row' => $rows)));
<?php

//--------------------------------------------------------------------------------------------------------------------------
// listAllergies.json.php
//
// v0.0.1
// Under GPLv3 License
//
// Integrated by: Gi Technologies. in 2011
//
// Remember, this file is called via the Framework Store, this is the AJAX thing.
//--------------------------------------------------------------------------------------------------------------------------
session_name("MitosEHR");
session_start();
session_cache_limiter('private');
include_once $_SESSION['site']['root'] . "/classes/dbHelper.php";
// **************************************************************************************
// Reset session count 10 secs = 1 Flop
// **************************************************************************************
$_SESSION['site']['flops'] = 0;
// **************************************************************************************
// Database class instance
// **************************************************************************************
$mitos_db = new dbHelper();
$mitos_db->setSQL("SELECT \n\t\t\t\t\t\t*\n\t\t\t\t\tFROM\n  \t\t\t\t\t\tlists\n\t\t\t\t\tWHERE\n  \t\t\t\t\t\ttype = 'allergy' AND enddate IS NULL\n\t\t\t\t\tORDER BY\n  \t\t\t\t\t\tbegdate");
$total = $mitos_db->rowCount();
$rows = array();
foreach ($mitos_db->execStatement(PDO::FETCH_ASSOC) as $row) {
    array_push($rows, $row);
}
print json_encode(array('totals' => $total, 'row' => $rows));
Exemplo n.º 28
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'];
$start = !$_REQUEST["start"] ? 0 : $_REQUEST["start"];
$limit = !$_REQUEST["limit"] ? 10 : $_REQUEST["limit"];
$rows = array();
switch ($_SERVER['REQUEST_METHOD']) {
    case 'GET':
        switch ($_GET['task']) {
            case "pharmacy":
                //******************************************************************
                // Lets get the pharmacies and address and order by name
                //******************************************************************
                $mitos_db->setSQL("SELECT pharmacies.id AS id,\n                                          pharmacies.name,\n                                          pharmacies.transmit_method,\n                                          pharmacies.email,\n                                          addresses.id AS address_id,\n                                          addresses.line1,\n                                          addresses.line2,\n                                          addresses.city,\n                                          addresses.state,\n                                          addresses.zip,\n                                          addresses.plus_four,\n                                          addresses.country,\n                                          addresses.foreign_id AS address_foreign_id\n                                     FROM pharmacies\n                                LEFT JOIN addresses ON pharmacies.id = addresses.foreign_id\n                                 ORDER BY pharmacies.name DESC");
                $total = $mitos_db->rowCount();
                foreach ($mitos_db->execStatement(PDO::FETCH_ASSOC) as $row) {
                    $mitos_db->setSQL("SELECT * FROM phone_numbers WHERE phone_numbers.foreign_id =" . $row['id'] . "");
                    foreach ($mitos_db->execStatement(PDO::FETCH_ASSOC) as $phoneRow) {
                        switch ($phoneRow['type']) {
                            case "2":
                                $row['phone_id'] = $phoneRow['id'];
                                $row['phone_country_code'] = $phoneRow['country_code'];
                                $row['phone_area_code'] = $phoneRow['area_code'];
                                $row['phone_prefix'] = $phoneRow['prefix'];
                                $row['phone_number'] = $phoneRow['number'];
                                $row['phone_full'] = $phoneRow['country_code'] . ' ' . $phoneRow['area_code'] . '-' . $phoneRow['prefix'] . '-' . $phoneRow['number'];
                                break;
                            case "5":
                                $row['fax_id'] = $phoneRow['id'];
Exemplo n.º 29
0
//------------------------------------------
// Database class instance
//------------------------------------------
$mitos_db = new dbHelper();
// *************************************************************************************
// Validate and pass the POST variables to an array
// This is the moment to validate the entered values from the user
// although Sencha EXTJS make good validation, we could check again
// just in case
// *************************************************************************************
$row['list_id'] = dataEncode($data->list_id);
$row['option_id'] = dataEncode($data->option_id);
$row['title'] = dataEncode($data->title);
$row['seq'] = dataEncode($data->seq);
$row['is_default'] = trim($data->is_default) == 'true' ? 1 : 0;
$row['option_value'] = dataEncode($data->option_value);
$row['mapping'] = dataEncode($data->mapping);
$row['notes'] = dataEncode($data->notes);
// *************************************************************************************
// Finally that validated POST variables is inserted to the database
// This one make the JOB of two, if it has an ID key run the UPDATE statement
// if not run the INSERT stament
// *************************************************************************************
$sql = $mitos_db->sqlBind($row, "list_options", "u", "id='" . $data->id . "'");
$mitos_db->setSQL($sql);
$ret = $mitos_db->execLog();
if ($ret == "") {
    echo '{ success: false, errors: { reason: "' . $ret[2] . '" }}';
} else {
    echo "{ success: true }";
}
Exemplo n.º 30
0
//******************************************************************************
// Reset session count 10 secs = 1 Flop
//******************************************************************************
$_SESSION['site']['flops'] = 0;
//-------------------------------------------
// password to AES and validate
//-------------------------------------------
$aes = new AES($_SESSION['site']['AESkey']);
//------------------------------------------
// Database class instance
//------------------------------------------
$mitos_db = new dbHelper();
// Setting defults incase no request is sent by sencha
$start = $_REQUEST["start"] == null ? 0 : $_REQUEST["start"];
$count = $_REQUEST["limit"] == null ? 10 : $_REQUEST["limit"];
$mitos_db->setSQL("SELECT users.*, \n          \t\t\t\t  list_options.option_id AS ab_name,\n          \t\t\t\t  list_options.title AS ab_title  \n        \t\t\t FROM users\n        \t\tLEFT JOIN list_options ON list_id = 'abook_type' AND option_id = users.abook_type\n        \t\t\tWHERE users.active = 1 AND ( users.authorized = 1 OR users.username = '' )\n        \t\t\tLIMIT " . $start . "," . $count);
//---------------------------------------------------------------------------------------
// catch the total records
//---------------------------------------------------------------------------------------
$total = $mitos_db->rowCount();
//---------------------------------------------------------------------------------------
// start the array
//---------------------------------------------------------------------------------------
$rows = array();
foreach ($mitos_db->execStatement(PDO::FETCH_ASSOC) as $row) {
    $row['fullname'] = fullname($row['fname'], $row['mname'], $row['lname']);
    if ($row['street'] != NULL || $row['street'] != "") {
        $rec['street'] = $row['street'] . "<br>";
    } else {
        $rec['street'] = $row['street'];
    }