Пример #1
0
function upload_img($file_upload_name)
{
    $imgName = $_FILES["{$file_upload_name}"]['name'];
    //上传文件的名称
    $imgType = $_FILES["{$file_upload_name}"]['type'];
    //上传文件的类型
    $imgSize = $_FILES["{$file_upload_name}"]['size'];
    //上传文件的大小
    $imgTmp_name = $_FILES["{$file_upload_name}"]['tmp_name'];
    //上传文件在服务器上的临时文件名称
    //随机生成一个图片名称
    $imgDbName = md5(getUuid());
    //截取文件的后缀
    $ext = explode(".", $imgName);
    $ext = $ext[count($ext) - 1];
    $savePath = "pages/upload/" . $imgDbName . "." . $ext;
    if (file_exists($savePath)) {
        //  如果存在这个路径
        echo $savePath . "already exists<br />\n";
    } else {
        // 不存在路径的时候
        move_uploaded_file($imgTmp_name, ykfile($savePath));
        return $savePath;
    }
}
Пример #2
0
function createCCR($action, $raw = "no", $requested_by = "")
{
    $authorID = getUuid();
    $patientID = getUuid();
    $sourceID = getUuid();
    $oemrID = getUuid();
    $result = getActorData();
    while ($res = sqlFetchArray($result[2])) {
        ${"labID{$res['id']}"} = getUuid();
    }
    $ccr = new DOMDocument('1.0', 'UTF-8');
    $e_styleSheet = $ccr->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="stylesheet/ccr.xsl"');
    $ccr->appendChild($e_styleSheet);
    $e_ccr = $ccr->createElementNS('urn:astm-org:CCR', 'ContinuityOfCareRecord');
    $ccr->appendChild($e_ccr);
    /////////////// Header
    require_once "createCCRHeader.php";
    $e_Body = $ccr->createElement('Body');
    $e_ccr->appendChild($e_Body);
    /////////////// Problems
    $e_Problems = $ccr->createElement('Problems');
    require_once "createCCRProblem.php";
    $e_Body->appendChild($e_Problems);
    /////////////// Alerts
    $e_Alerts = $ccr->createElement('Alerts');
    require_once "createCCRAlerts.php";
    $e_Body->appendChild($e_Alerts);
    ////////////////// Medication
    $e_Medications = $ccr->createElement('Medications');
    require_once "createCCRMedication.php";
    $e_Body->appendChild($e_Medications);
    ///////////////// Immunization
    $e_Immunizations = $ccr->createElement('Immunizations');
    require_once "createCCRImmunization.php";
    $e_Body->appendChild($e_Immunizations);
    /////////////////// Results
    $e_Results = $ccr->createElement('Results');
    require_once "createCCRResult.php";
    $e_Body->appendChild($e_Results);
    /////////////////// Procedures
    //$e_Procedures = $ccr->createElement('Procedures');
    //require_once("createCCRProcedure.php");
    //$e_Body->appendChild($e_Procedures);
    //////////////////// Footer
    // $e_VitalSigns = $ccr->createElement('VitalSigns');
    // $e_Body->appendChild($e_VitalSigns);
    /////////////// Actors
    $e_Actors = $ccr->createElement('Actors');
    require_once "createCCRActor.php";
    $e_ccr->appendChild($e_Actors);
    if ($action == "generate") {
        gnrtCCR($ccr, $raw, $requested_by);
    }
    if ($action == "viewccd") {
        viewCCD($ccr, $raw, $requested_by);
    }
}
Пример #3
0
 function advancedSort($db, $tabledefid)
 {
     $this->db = $db;
     $this->tabledefid = $tabledefid;
     $this->tabledefuuid = getUuid($this->db, "tbld:5c9d645f-26ab-5003-b98e-89e9049f8ac3", (int) $tabledefid);
     $querystatement = "\n                SELECT\n                    `prefix`\n                FROM\n                    `tabledefs`\n                WHERE\n                    `uuid` = '" . $this->tabledefuuid . "'\n            ";
     $queryresult = $this->db->query($querystatement);
     $therecord = $this->db->fetchArray($queryresult);
     $this->prefix = $therecord["prefix"];
 }
Пример #4
0
function createCCR($action, $raw = "no")
{
    $authorID = getUuid();
    echo '<!--';
    $ccr = new DOMDocument('1.0', 'UTF-8');
    $e_styleSheet = $ccr->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="ccr.xsl"');
    $ccr->appendChild($e_styleSheet);
    $e_ccr = $ccr->createElementNS('urn:astm-org:CCR', 'ContinuityOfCareRecord');
    $ccr->appendChild($e_ccr);
    /////////////// Header
    require_once "createCCRHeader.php";
    $e_Body = $ccr->createElement('Body');
    $e_ccr->appendChild($e_Body);
    /////////////// Problems
    $e_Problems = $ccr->createElement('Problems');
    require_once "createCCRProblem.php";
    $e_Body->appendChild($e_Problems);
    /////////////// Alerts
    $e_Alerts = $ccr->createElement('Alerts');
    require_once "createCCRAlerts.php";
    $e_Body->appendChild($e_Alerts);
    ////////////////// Medication
    $e_Medications = $ccr->createElement('Medications');
    require_once "createCCRMedication.php";
    $e_Body->appendChild($e_Medications);
    ///////////////// Immunization
    $e_Immunizations = $ccr->createElement('Immunizations');
    require_once "createCCRImmunization.php";
    $e_Body->appendChild($e_Immunizations);
    /////////////////// Results
    $e_Results = $ccr->createElement('Results');
    require_once "createCCRResult.php";
    $e_Body->appendChild($e_Results);
    /////////////////// Procedures
    $e_Procedures = $ccr->createElement('Procedures');
    require_once "createCCRProcedure.php";
    $e_Body->appendChild($e_Procedures);
    //////////////////// Footer
    // $e_VitalSigns = $ccr->createElement('VitalSigns');
    // $e_Body->appendChild($e_VitalSigns);
    /////////////// Actors
    $e_Actors = $ccr->createElement('Actors');
    require_once "createCCRActor.php";
    $e_ccr->appendChild($e_Actors);
    // save created CCR in file
    echo " \n action=" . $action;
    if ($action == "generate") {
        gnrtCCR($ccr, $raw);
    }
    if ($action == "viewccd") {
        viewCCD($ccr, $raw);
    }
}
Пример #5
0
 function recurringinvoice($db, $invoiceid)
 {
     $this->db = $db;
     $this->invoiceid = (int) $invoiceid;
     $this->invoiceuuid = getUuid($this->db, "tbld:62fe599d-c18f-3674-9e54-b62c2d6b1883", $this->invoiceid);
     $this->weekArray = array("First" => "1", "Second" => "2", "Third" => "3", "Fourth" => "4", "Last" => "5");
     $this->dayOfWeekArray = array();
     $this->dayOfWeekArray[nl_langinfo(constant("DAY_1"))] = 7;
     for ($i = 1; $i <= 6; $i++) {
         $this->dayOfWeekArray[nl_langinfo(constant("DAY_" . ($i + 1)))] = $i;
     }
 }
Пример #6
0
 public function copyRecordToTmp($recno, $new_record = FALSE)
 {
     setMickaLog("Copy record recno={$recno} to TMP", 'DEBUG', 'MdRecord.copyRecordToTmp');
     $rs = array();
     $rs['ok'] = FALSE;
     $rs['recno_tmp'] = -1;
     $rs['report'] = '';
     if ($recno == '' || $recno < 1) {
         setMickaLog("Record not exist", 'ERROR', 'MdRecord.copyRecordToTmp');
         $rs['report'] = 'Record not exist';
         return $rs;
     }
     $this->setTableMode('md');
     $md = $this->getMd('recno', $recno);
     if ($md['report'] != 'ok' || $this->md_record['md']['RECNO'] != $recno) {
         setMickaLog($md['report'], 'ERROR', 'MdRecord.copyRecordToTmp');
         $rs['report'] = $md['report'];
         return $rs;
     }
     if ($this->md_record['user_right'] == 'r') {
         setMickaLog("Not edit rights", 'ERROR', 'MdRecord.copyRecordToTmp');
         $rs['report'] = 'Not edit rights';
         return $rs;
     }
     $mds = isset($md['md']['MD_STANDARD']) ? $md['md']['MD_STANDARD'] : '';
     $this->deleteTmpRecords();
     $sql = array();
     $recno_tmp = $this->getNewRecno($this->table_md);
     $sid = $this->sid;
     $tmp_table_md = TMPTABLE_PREFIX . '_md';
     $tmp_table_md_values = TMPTABLE_PREFIX . '_md_values';
     if ($new_record === TRUE) {
         // nový záznam kopií stávajícího
         $uuid = getUuid();
         $create_user = $this->user;
         $create_date = DB_DRIVER == 'mssql2005' ? str_replace('-', '', getNewDate()) : getNewDate();
         $edit_group = $this->defaultValueMd['edit_group'];
         $view_group = $this->defaultValueMd['view_group'];
         array_push($sql, "\n\t\t\t\tINSERT INTO {$tmp_table_md} (sid,recno,uuid,md_standard,lang,data_type,create_user,create_date,edit_group,view_group,x1,y1,x2,y2,the_geom,range_begin,range_end,md_update,title,server_name,pxml,valid)\n\t\t\t\tSELECT %s,%i,'{$uuid}',md_standard,lang,0,'{$create_user}','{$create_date}','{$edit_group}','{$view_group}',x1,y1,x2,y2,the_geom,range_begin,range_end,md_update,title,server_name,pxml,valid\n\t\t\t\tFROM md WHERE recno=%i\n\t\t\t", $this->sid, $recno_tmp, $recno);
     } else {
         array_push($sql, "\n\t\t\t\tINSERT INTO {$tmp_table_md} (sid,recno,uuid,md_standard,lang,data_type,create_user,create_date,edit_group,view_group,x1,y1,x2,y2,the_geom,range_begin,range_end,md_update,title,server_name,xmldata,pxml,valid)\n\t\t\t\tSELECT %s,%i,uuid,md_standard,lang,data_type,create_user,create_date,edit_group,view_group,x1,y1,x2,y2,the_geom,range_begin,range_end,md_update,title,server_name,xmldata,pxml,valid\n\t\t\t\tFROM md WHERE recno=%i\n\t\t\t", $this->sid, $recno_tmp, $recno);
     }
     $result = _executeSql('insert', $sql, array('all'));
     $sql = array();
     array_push($sql, "\n\t\t\tINSERT INTO {$tmp_table_md_values} (recno, md_id, md_value, md_path, lang , package_id)\n\t\t\tSELECT %i, md_id, md_value, md_path, lang , package_id FROM md_values WHERE recno=%i\n\t\t", $recno_tmp, $recno);
     $result = _executeSql('insert', $sql, array('all'));
     if ($new_record) {
         // nové uuid do md_values
         if ($mds == 0 || $mds == 10) {
             $sql = array();
             array_push($sql, "DELETE FROM {$tmp_table_md_values} WHERE recno=%i AND md_id=38", $recno_tmp);
             $result = _executeSql('delete', $sql, array('all'));
             $this->setTableMode('tmp');
             $this->getMd('recno', $recno_tmp);
             $this->setMdValuesFileIdentifier($recno_tmp, $mds, $uuid);
         }
     }
     $rs['recno_tmp'] = $recno_tmp;
     $rs['report'] = 'ok';
     $rs['ok'] = TRUE;
     return $rs;
 }
Пример #7
0
     $xml->open_customTag('reference', $arr);
     //externalObservation Start
     $arr = array('classCode' => 'OBS', 'moodCode' => 'EVN');
     $xml->open_customTag('externalObservation', $arr);
     //Modified HQMF_ID for CQM IDS
     if ($row['cqm_nqf_code'] == "0421") {
         $refID = $preDefPopIdArr[$row['cqm_nqf_code']][$row['numerator_label']][$mainQrdaPopulationIncArr[$cqmKey]];
     } else {
         if ($row['cqm_nqf_code'] == "0024") {
             $refID = $preDefPopIdArr[$row['cqm_nqf_code']][$row['population_label']][$row['numerator_label']][$mainQrdaPopulationIncArr[$cqmKey]];
         } else {
             $refID = $preDefPopIdArr[$row['cqm_nqf_code']][$mainQrdaPopulationIncArr[$cqmKey]];
         }
     }
     if ($refID == "") {
         $refID = getUuid();
     }
     $xml->self_customId($refID);
     //externalObservation Close
     $xml->close_customTag();
     //reference Close
     $xml->close_customTag();
     ########################################################################
     //observation Close
     $xml->close_customTag();
     $xml->close_loopComponent();
     ############### Initial patient population template END#####################
 }
 //Multiple Numerator Handling
 if (in_array($row['cqm_nqf_code'], $multNumNQFArr)) {
     //Skipping Multiple Numerator(s)
Пример #8
0
require_once 'common/config/conf.php';
require_once 'common/functions.php';
isset($_POST['username']) ? $username = $_POST['username'] : ($username = null);
isset($_POST['passwd']) ? $passwd = $_POST['passwd'] : ($passwd = null);
//检查用户名
function check_username()
{
    $dbh = mysql::getInstance();
    $username = $dbh->select('blog_users', ['username' => $_GET['username']]);
    if ($username) {
        //该用户已存在
        echo 201;
    } else {
        //该用户不存在
        echo 404;
    }
}
if (isset($_GET['username']) ? $_GET['username'] : false) {
    check_username();
}
//用户注册
//TODO: 注册后的操作
if ($username != null && $passwd != null) {
    $dbh = mysql::getInstance();
    if ($dbh->insert('blog_users', ['id' => getUuid(), 'username' => $username, 'passwd' => $passwd])) {
        setcookie('username', $username, COOKIE_EXPIRE);
        header("location:http://localhost:8080/blog/index.php");
    } else {
        echo 'it false';
    }
}
Пример #9
0
a<?php 
require_once zeroPath('Mysql.class.php');
$uuid = getUuid();
$sql = "insert into zp_user (uuid, user_name, password, sex, age, avatar, time, login_ip) values ('" . $uuid . "', 'zero', '" . md5('111111') . "', 1, 25, 'http://pics.sc.chinaz.com/files/pic/pic9/201511/apic16807.jpg', '" . date('Y:m:d h:i:s', time()) . "', '" . getIp() . "')";
$result = $db->adu($sql);
Пример #10
0
function patCharactersticQRDA($xml, $patient_id)
{
    //Patient History
    $patHist = patientQRDAHistory($patient_id);
    //Entry open
    $xml->open_entry();
    //observation Open
    $xml->open_customTag('observation', array('classCode' => 'OBS', 'moodCode' => 'EVN'));
    $tempID = "2.16.840.1.113883.10.20.22.4.85";
    $xml->self_templateid($tempID);
    $actId = getUuid();
    $xml->self_customId($actId);
    $arr = array('code' => 'ASSERTION', 'displayName' => 'Assertion', 'codeSystem' => '2.16.840.1.113883.5.4', 'codeSystemName' => 'ActCode');
    $xml->self_codeCustom($arr);
    $arr = array('code' => 'completed');
    $xml->self_customTag('statusCode', $arr);
    $timeArr = array('low' => date('Ymdhis', strtotime($patHist['date'])), 'high' => date('Ymdhis', strtotime($patHist['date'])));
    $xml->add_entryEffectTime($timeArr);
    $xml->self_customTag('value', array('xsi:type' => 'CD', 'code' => '160603005', 'codeSystem' => '2.16.840.1.113883.6.96'));
    //observation Close
    $xml->close_customTag();
    //Entry close
    $xml->close_entry();
}
Пример #11
0
 function prepareVariables($variables, $userid = NULL)
 {
     if ($userid == NULL) {
         if (isset($_SESSION["userinfo"]["id"])) {
             $userid = $_SESSION["userinfo"]["id"];
         }
     }
     if ($variables["id"]) {
         //i.e. only on update
         unset($this->fields["type"]);
         if ($variables["typeCheck"] == "TS" && isset($variables["repeating"]) && $variables["lastrepeat"]) {
             $variables["lastrepeat"] = NULL;
             $variables["firstrepeat"] = NULL;
             $variables["timesrepeated"] = NULL;
             if (isset($variables["completed"])) {
                 $variables["completedChange"] = 0;
             }
             $this->resetRepeating($variables["id"]);
         }
         //end if
     }
     //end if
     if (isset($variables["thetype"])) {
         $variables["type"] = $variables["thetype"];
     }
     if (!isset($variables["completed"])) {
         $variables["completeddate"] = NULL;
     }
     if ($variables["enddate"] == "") {
         $variables["enddate"] = NULL;
         $variables["endtime"] = NULL;
     }
     if ($variables["startdate"] == "") {
         $variables["startdate"] = NULL;
         $variables["starttime"] = NULL;
     }
     if (isset($variables["repeating"])) {
         $thename = "Every ";
         switch ($variables["repeattype"]) {
             case "Daily":
                 if ($variables["repeatevery"] != 1) {
                     $thename .= $variables["repeatevery"] . " days";
                 } else {
                     $thename .= " day ";
                 }
                 $variables["repeatechlist"] = NULL;
                 $variables["repeatontheday"] = NULL;
                 $variables["repeatontheweek"] = NULL;
                 break;
             case "Weekly":
                 if ($variables["repeatevery"] != 1) {
                     $thename .= $variables["repeatevery"] . " weeks on";
                 } else {
                     $thename .= "week on";
                 }
                 foreach (explode("::", $variables["eachlist"]) as $dayNum) {
                     $tempday = $dayNum != 7 ? $dayNum + 1 : 1;
                     $thename .= " " . nl_langinfo(constant("ABDAY_" . $tempday)) . ", ";
                 }
                 $thename = substr($thename, 0, strlen($thename) - 2);
                 if (strpos($thename, ",") != false) {
                     $thename = strrev(preg_replace("/,/", "dna ", strrev($thename), 1));
                 }
                 $variables["repeateachlist"] = $variables["eachlist"];
                 $variables["repeatontheday"] = NULL;
                 $variables["repeatontheweek"] = NULL;
                 break;
             case "Monthly":
                 if ($variables["repeatevery"] != 1) {
                     $thename .= $variables["repeatevery"] . " months";
                 } else {
                     $thename .= "month";
                 }
                 $thename .= " on the";
                 if ($variables["monthlyWhat"] == 1) {
                     foreach (explode("::", $variables["eachlist"]) as $dayNum) {
                         $thename .= " " . ordinal($dayNum) . ", ";
                     }
                     $thename = substr($thename, 0, strlen($thename) - 2);
                     if (strpos($thename, ",") != false) {
                         $thename = strrev(preg_replace("/,/", "dna ", strrev($thename), 1));
                     }
                     $variables["repeateachlist"] = $variables["eachlist"];
                     $variables["repeatontheday"] = NULL;
                     $variables["repeatontheweek"] = NULL;
                 } else {
                     foreach ($this->weekArray as $key => $value) {
                         if ($value == $variables["monthlyontheweek"]) {
                             $thename .= " " . strtolower($key);
                         }
                     }
                     foreach ($this->dayOfWeekArray as $key => $value) {
                         if ($value == $variables["monthlyontheday"]) {
                             $thename .= " " . $key;
                         }
                     }
                     $variables["repeateachlist"] = NULL;
                     $variables["repeatontheday"] = $variables["monthlyontheday"];
                     $variables["repeatontheweek"] = $variables["monthlyontheweek"];
                 }
                 break;
             case "Yearly":
                 if ($variables["repeatevery"] > 1) {
                     $thename .= $variables["repeatevery"] . " years";
                 } else {
                     $thename .= "year";
                 }
                 $thename .= " in";
                 foreach (explode("::", $variables["eachlist"]) as $monthNum) {
                     $thename .= " " . nl_langinfo(constant("MON_" . $monthNum)) . ", ";
                 }
                 $thename = substr($thename, 0, strlen($thename) - 2);
                 if (strpos($thename, ",") != false) {
                     $thename = strrev(preg_replace("/,/", "dna ", strrev($thename), 1));
                 }
                 $variables["repeateachlist"] = $variables["eachlist"];
                 if (isset($variables["yearlyOnThe"])) {
                     $thename .= " on the";
                     foreach ($this->weekArray as $key => $value) {
                         if ($value == $variables["yearlyontheweek"]) {
                             $thename .= " " . strtolower($key);
                         }
                     }
                     foreach ($this->dayOfWeekArray as $key => $value) {
                         if ($value == $variables["yearlyontheday"]) {
                             $thename .= " " . $key;
                         }
                     }
                     $variables["repeatontheday"] = $variables["yearlyontheday"];
                     $variables["repeatontheweek"] = $variables["yearlyontheweek"];
                 } else {
                     $variables["repeatontheday"] = NULL;
                     $variables["repeatontheweek"] = NULL;
                 }
                 //end if
                 break;
         }
         switch ($variables["repeatend"]) {
             case "never":
                 $variables["repeatuntil"] = NULL;
                 $variables["repeattimes"] = NULL;
                 break;
             case "after":
                 $thename .= " for " . $variables["repeattimes"];
                 $variables["repeatuntil"] = NULL;
                 break;
             case "on date":
                 $thename .= " until " . $variables["repeatuntil"];
                 $variables["repeattimes"] = NULL;
                 break;
         }
         $thename = trim($thename) . ".";
         $variables["repeatname"] = $thename;
         $variables["firstrepeat"] = dateToString(stringToDate($variables["firstrepeat"], "SQL"));
         $variables["lastrepeat"] = dateToString(stringToDate($variables["lastrepeat"], "SQL"));
         $variables["timesrepeated"] = NULL;
     } else {
         $variables["repeat"] = 0;
         $variables["repeatechlist"] = NULL;
         $variables["repeatontheday"] = NULL;
         $variables["repeatontheweek"] = NULL;
         $variables["repeatname"] = NULL;
         $variables["repeatuntil"] = NULL;
         $variables["repeattimes"] = NULL;
         $variables["firstrepeat"] = NULL;
         $variables["lastrepeat"] = NULL;
         $variables["timesrepeated"] = NULL;
     }
     //endif repeat
     if ($variables["assignedtoid"] != $variables["assignedtochange"]) {
         if ($variables["assignedtoid"] != "") {
             $variables["assignedbyid"] = getUuid($this->db, "tbld:afe6d297-b484-4f0b-57d4-1c39412e9dfb", $userid);
         } else {
             $variables["assignedbyid"] = '';
         }
     }
     //endif
     return $variables;
 }
Пример #12
0
 $e_Gender->appendChild($e_Code);
 $e_Value = $ccr->createElement('Value');
 $e_Code->appendChild($e_Value);
 $e_IDs = $ccr->createElement('IDs');
 $e_Actor->appendChild($e_IDs);
 $e_Type = $ccr->createElement('Type');
 $e_IDs->appendChild($e_Type);
 $e_Text = $ccr->createElement('Text', 'Patient ID');
 $e_Type->appendChild($e_Text);
 $e_ID = $ccr->createElement('ID', $row['pid']);
 $e_IDs->appendChild($e_ID);
 $e_Source = $ccr->createElement('Source');
 $e_IDs->appendChild($e_Source);
 $e_SourceActor = $ccr->createElement('Actor');
 $e_Source->appendChild($e_SourceActor);
 $e_ActorID = $ccr->createElement('ActorID', getUuid());
 $e_SourceActor->appendChild($e_ActorID);
 // address
 $e_Address = $ccr->createElement('Address');
 $e_Actor->appendChild($e_Address);
 $e_Type = $ccr->createElement('Type');
 $e_Address->appendChild($e_Type);
 $e_Text = $ccr->createElement('Text', 'H');
 $e_Type->appendChild($e_Text);
 $e_Line1 = $ccr->createElement('Line1', $row['street']);
 $e_Address->appendChild($e_Line1);
 $e_Line2 = $ccr->createElement('Line2');
 $e_Address->appendChild($e_Line1);
 $e_City = $ccr->createElement('City', $row['city']);
 $e_Address->appendChild($e_City);
 $e_State = $ccr->createElement('State', $row['state']);
Пример #13
0
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 3
 * of the License, or (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
 *
 * @package OpenEMR
 * @author  Garden State Health Systems <http://www.gshsys.com/>
 * @link    http://www.open-emr.org
 */
global $pid;
$e_ccrDocObjID = $ccr->createElement('CCRDocumentObjectID', getUuid());
$e_ccr->appendChild($e_ccrDocObjID);
$e_Language = $ccr->createElement('Language');
$e_ccr->appendChild($e_Language);
$e_Text = $ccr->createElement('Text', 'English');
$e_Language->appendChild($e_Text);
$e_Version = $ccr->createElement('Version', 'V1.0');
$e_ccr->appendChild($e_Version);
$e_dateTime = $ccr->createElement('DateTime');
$e_ccr->appendChild($e_dateTime);
$e_ExactDateTime = $ccr->createElement('ExactDateTime', date('Y-m-d\\TH:i:s\\Z'));
$e_dateTime->appendChild($e_ExactDateTime);
$e_patient = $ccr->createElement('Patient');
$e_ccr->appendChild($e_patient);
//$e_ActorID = $ccr->createElement('ActorID', $row['patient_id']);
$e_ActorID = $ccr->createElement('ActorID', 'A1234');
Пример #14
0
 function importRecords($rows, $titles)
 {
     switch ($this->importType) {
         case "sugarcrm":
             $thereturn = $this->_formatSugarVariables($rows, $titles);
             $rows = $thereturn["rows"];
             $titles = $thereturn["titles"];
         case "csv":
             //count total fieldnames (top row of csv document)
             $fieldNum = count($titles);
             //the file starts at line number 1, but since line 1 is
             //supposed to be the fieldnames in the table(s), the lines
             //being insereted start @ 2.
             $rowNum = 2;
             //get the data one row at a time
             foreach ($rows as $rowData) {
                 $theid = 0;
                 // set for when verifification does not pass
                 $verify = array();
                 //set for when number of field rows does not match number of titles
                 //trim off leading/trailing spaces
                 $trimmedRowData = array();
                 foreach ($rowData as $name => $data) {
                     $trimmedRowData[$name] = trim($data);
                 }
                 //check to see if number of fieldnames is consistent for each row
                 $rowFieldNum = count($trimmedRowData);
                 //if valid, insert, if not, log error and don't insert.
                 if ($rowFieldNum == $fieldNum) {
                     $verify = $this->table->verifyVariables($trimmedRowData);
                     if (!count($verify)) {
                         $createdby = NULL;
                         $overrideID = true;
                         $replace = false;
                         if (!isset($trimmedRowData["uuid"])) {
                             $useUuid = true;
                             $thereturn = $this->table->insertRecord($trimmedRowData, $createdby, $overrideID, $replace, $useUuid);
                             $theid = $thereturn["id"];
                         } else {
                             $useUuid = false;
                             $thereturn = $this->table->insertRecord($trimmedRowData, $createdby, $overrideID, $replace, $useUuid);
                             $theid = $thereturn;
                         }
                         //end if
                     }
                     //end if
                 } else {
                     $this->error .= '<li> incorrect amount of fields for line number ' . $rowNum . '.</li>';
                 }
                 if ($theid) {
                     //keep track of the ids in the transaction to be able to select them
                     //for preview purposes
                     $this->transactionIDs[] = $theid;
                     //get first id to correct auto increment
                     if (!$this->revertID) {
                         $this->revertID = $theid;
                     }
                     $theuuid = getUuid($this->table->db, "tbld:6d290174-8b73-e199-fe6c-bcf3d4b61083", (int) $theid);
                     //If it is a sugarcrm import, insert the shipping address as well
                     $addressVerify = array();
                     if ($this->importType == "sugarcrm") {
                         $variables = array();
                         if ($trimmedRowData["shipaddress1"]) {
                             $variables["address1"] = $trimmedRowData["shipaddress1"];
                         }
                         if ($trimmedRowData["shipcity"]) {
                             $variables["city"] = $trimmedRowData["shipcity"];
                         }
                         if ($trimmedRowData["shipstate"]) {
                             $variables["state"] = $trimmedRowData["shipstate"];
                         }
                         if ($trimmedRowData["shipcountry"]) {
                             $variables["country"] = $trimmedRowData["shipcountry"];
                         }
                         //check to see if there is a shipping address
                         if (count($variables)) {
                             //If there is a shipping address, we need to make any others'
                             //`defaultshipto` to 0
                             $querystatement = "\n\t\t\t\t\t\t\t\t\t\tUPDATE\n\t\t\t\t\t\t\t\t\t\t\t`addresstorecord`\n\t\t\t\t\t\t\t\t\t\tSET\n\t\t\t\t\t\t\t\t\t\t\t`addresstorecord`.`defaultshipto` = '0'\n\t\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t\t`addresstorecord`.`recordid` = '" . mysql_real_escape_string($theuuid) . "'\n\t\t\t\t\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\t\t\t\t`addresstorecord`.`tabledefid` = 'tbld:6d290174-8b73-e199-fe6c-bcf3d4b61083';\n\t\t\t\t\t\t\t\t\t\t";
                             $this->table->db->query($querystatement);
                             $variables["title"] = "Main Shipping Address";
                             $variables["tabledefid"] = "tbld:6d290174-8b73-e199-fe6c-bcf3d4b61083";
                             $variables["recordid"] = $theuuid;
                             $variables["defaultshipto"] = 1;
                             $variables["primary"] = 0;
                             $variables["existingaddressid"] = false;
                             $variables["uuid"] = uuid($this->table->address->prefix);
                             $addressVerify = $this->table->address->verifyVariables($variables);
                             //verify address
                             if (!count($addressVerify)) {
                                 //check for errors
                                 $this->table->address->insertRecord($variables);
                             }
                             //insert if no errors
                         }
                         //end if
                     }
                     //end if
                 } else {
                     $this->error .= '<li> failed insert for line number ' . $rowNum . '.</li>';
                 }
                 foreach ($verify as $error) {
                     //log verify errors for display
                     $this->error .= '<li class="subError">' . $error . '</li>';
                 }
                 if (isset($addressVerify)) {
                     foreach ($addressVerify as $error) {
                         //log address verify errors for display
                         $this->error .= '<li class="subError">' . $error . '</li>';
                     }
                 }
                 $rowNum++;
             }
             //end foreach
             break;
     }
     //end switch
 }
Пример #15
0
 function insertRecord($variables, $createdby = NULL, $overrideID = false, $replace = false, $useUuid = false)
 {
     if ($createdby === NULL) {
         $createdby = $_SESSION["userinfo"]["id"];
     }
     $newid = parent::insertRecord($variables, $createdby, $overrideID, $replace, $useUuid);
     $id = $newid;
     if (isset($newid["uuid"])) {
         $id = $newid["id"];
     }
     if (ENCRYPT_PAYMENT_FIELDS && (isset($variables["ccnumber"]) || isset($variables["ccexpiration"]) || isset($variables["ccverification"]) || isset($variables["accountnumber"]) || isset($variables["routingnumber"]))) {
         if ($useUuid) {
             $whereclause = "`uuid` = '" . $newid["uuid"] . "'";
         } else {
             $whereclause = "`id` = '" . $newid . "'";
         }
         $querystatement = "\n\t\t\t\t\tUPDATE\n\t\t\t\t\t\t`invoices`\n\t\t\t\t\tSET ";
         $fieldlist = "";
         if (isset($variables["ccnumber"])) {
             $variables["ccnumber"] = mysql_real_escape_string($variables["ccnumber"]);
             $fieldlist .= ", `ccnumber` = " . $this->db->encrypt("'" . $variables["ccnumber"] . "'");
         }
         //end if
         if (isset($variables["ccexpiration"])) {
             $variables["ccexpiration"] = mysql_real_escape_string($variables["ccexpiration"]);
             $fieldlist .= ", `ccexpiration` = " . $this->db->encrypt("'" . $variables["ccexpiration"] . "'");
         }
         //end if
         if (isset($variables["ccverification"])) {
             $variables["ccverification"] = mysql_real_escape_string($variables["ccverification"]);
             $fieldlist .= ", `ccverification` = " . $this->db->encrypt("'" . $variables["ccverification"] . "'");
         }
         //end if
         if (isset($variables["accountnumber"])) {
             $variables["accountnumber"] = mysql_real_escape_string($variables["accountnumber"]);
             $fieldlist .= ", `accountnumber` = " . $this->db->encrypt("'" . $variables["accountnumber"] . "'");
         }
         //end if
         if (isset($variables["routingnumber"])) {
             $variables["routingnumber"] = mysql_real_escape_string($variables["routingnumber"]);
             $fieldlist .= ", `routingnumber` = " . $this->db->encrypt("'" . $variables["routingnumber"] . "'");
         }
         //end if
         $fieldlist = substr($fieldlist, 1);
         $querystatement .= $fieldlist . " WHERE `type` != 'Invoice' AND `type` != 'VOID' AND " . $whereclause;
         $this->db->query($querystatement);
     }
     //end if
     if (!isset($variables["billingsaveoptions"])) {
         $variables["billingsaveoptions"] = NULL;
     }
     if (!isset($variables["shiptosaveoptions"])) {
         $variables["shiptosaveoptions"] = NULL;
     }
     if ($variables["billingsaveoptions"] != "orderOnly" || $variables["shiptosaveoptions"] != "orderOnly") {
         require_once "addresses.php";
         require_once "addresstorecord.php";
         if (!isset($variables["uuid"])) {
             $variables["uuid"] = getUuid($this->db, $this->uuid, $newid);
         }
         $newuuid = mysql_real_escape_string($variables["uuid"]);
         $this->addressUpdate($variables, $newuuid, $createdby, "billing");
         $this->addressUpdate($variables, $newuuid, $createdby, "shipping");
     }
     //end if
     if (!isset($variables["lineitemschanged"])) {
         $variables["lineitemschanged"] = '';
     }
     if ($variables["lineitemschanged"] == 1) {
         if ($this->lineitems === NULL) {
             $this->lineitems = new lineitems($this->db, $id);
         } else {
             $this->lineitems->invoiceid = $id;
         }
         $this->lineitems->set($variables["thelineitems"], $createdby);
     }
     //end if
     if (!isset($variables["statusdate"])) {
         $variables["statusdate"] = '';
     }
     if (!isset($variables["assignedtoid"])) {
         $variables["assignedtoid"] = '';
     }
     //if($variables["statuschanged"]==1)
     $this->updateStatus($id, $variables["statusid"], $variables["statusdate"], $variables["assignedtoid"], $replace);
     if ($variables["clienttype"] == "prospect" && $variables["type"] == "Order") {
         $this->prospectToClient($variables["clientid"]);
     }
     return $newid;
 }
Пример #16
0
<?php

require_once 'common/config/conf.php';
require_once 'vendor/mysql.php';
//require_once 'vendor/page.php';
require_once 'common/functions.php';
$dbh = mysql::getInstance();
$value = ['id' => getUuid(), 'username' => '1zzz', 'passwd' => '1zzz', 'email' => '*****@*****.**'];
//$dbh->insert('blog_users', $value);
//var_dump($dbh->select('blog_users'));
//$dbh->insert('c',['id'=>11]);
$list = $dbh->select('blog_users', [], [0, 1], 'id', 'desc');
//print_r($list);
//var_dump($value);
$data = [];
//$data['id'] = 11;
//$data['author_id'] = 11;
//$data['post_content'] = 'asdfa';
//if ($dbh->insert('blog_posts', $data)) {
//    echo 'it work';
//} else {
//    echo 'failure';
//}
//$data['id'] = getUuid();
//$data['post_author_id'] = 11;
//$data['post_title'] = 'asdfasf';
//$data['post_content'] = '<p>wfasdf</p>';
//$dbh->insert('blog_posts', $data);
//var_dump($data);
header('charset=utf8');
$posts = $dbh->select('blog_posts', ['id' => $post_id = 145786642660151]);
Пример #17
0
    /**
     * displays the load box for saved searches
     *
     * @param integer $tabledefid id of tabledef
     * @param string $userid uuid of user
     * @param string $securitywhere additional security based where clause to pass
     */
    function showLoad($tabledefid, $userid, $securitywhere)
    {
        $uuid = getUuid($this->db, "tbld:5c9d645f-26ab-5003-b98e-89e9049f8ac3", $tabledefid);
        $querystatement = "\n                    SELECT\n                            id,\n                            name,\n                            userid\n                    FROM\n                            usersearches\n                    WHERE\n                            tabledefid = '" . $uuid . "'\n                            AND type='SCH'\n                            AND (\n                                    (userid = '' " . $securitywhere . ")\n                                    OR userid = '" . $userid . "')\n                    ORDER BY\n                            userid,\n                            name";
        $queryresult = $this->db->query($querystatement);
        if (!$queryresult) {
            $error = new appError(500, "Cannot retrieve saved search information");
        }
        $querystatement = "\n                    SELECT\n                            advsearchroleid\n                    FROM\n                            tabledefs\n                    WHERE id= '" . $tabledefid . "'";
        $tabledefresult = $this->db->query($querystatement);
        if (!$tabledefresult) {
            $error = new appError(500, "Cannot retrieve table definition information.");
        }
        $tableinfo = $this->db->fetchArray($tabledefresult);
        ?>
            <table border="0" cellpadding="0" cellspacing="0">
                    <tr>
                            <td valign="top">
                                    <p>
                                            <label for="LSList">saved searches</label><br />
                                            <?php 
        $this->showSavedSearchList($queryresult);
        ?>
                                    </p>
                            </td>
                            <td valign="top" width="100%">
                                    <p>
                                            <label for="LSSelectedSearch">name</label><br />
                                            <input type="text" id="LSSelectedSearch" size="10" readonly="readonly" class="uneditable" />
                                    </p>
                                    <p>
                                            <textarea id="LSSQL" name="LSSQL" rows="8" cols="10" <?php 
        if (!hasRights($tableinfo["advsearchroleid"])) {
            echo ' readonly="readonly"';
        }
        ?>
></textarea>
                                    </p>
                            </td>
                            <td valign="top">
                                    <p><br/><input id="LSLoad" type="submit" name="command" class="Buttons" disabled="disabled" value="run search"/></p>
                                    <p><input id="LSDelete" type="button" onclick="LSDeleteSearch('<?php 
        echo APP_PATH;
        ?>
')" class="Buttons" disabled="disabled" value="delete"/></p>
                                    <div id="LSResults">&nbsp;</div>
                            </td>
                    </tr>
            </table>
            <?php 
    }
Пример #18
0
 /**
  * Add user information to the database
  *
  * @param $data
  * @throws \Exception
  * @return Users $this
  *
  */
 public function addUser($data)
 {
     $this->uuid = getUuid();
     $this->firstname = default_key_value(CONSTANTS::KEY_FIRSTNAME, $data, CONSTANTS::EMPTY_VALUE);
     $this->lastname = default_key_value(CONSTANTS::KEY_LASTNAME, $data, CONSTANTS::EMPTY_VALUE);
     $this->gender = default_key_value(CONSTANTS::KEY_GENDER, $data, CONSTANTS::EMPTY_VALUE);
     $this->age = default_key_value(CONSTANTS::KEY_AGE, $data, 0);
     $this->email = default_key_value(CONSTANTS::KEY_EMAIL, $data, CONSTANTS::EMPTY_VALUE);
     $this->income = default_key_value(CONSTANTS::KEY_INCOME, $data, 0);
     $this->nationality = default_key_value(CONSTANTS::KEY_NATIONALITY, $data, CONSTANTS::EMPTY_VALUE);
     $this->facebook_id = default_key_value(CONSTANTS::KEY_FACEBOOK_ID, $data, CONSTANTS::EMPTY_VALUE);
     $this->device_id = default_key_value(CONSTANTS::KEY_DEVICE_ID, $data, CONSTANTS::EMPTY_VALUE);
     $this->device_type = default_key_value(CONSTANTS::KEY_DEVICE_TYPE, $data, CONSTANTS::DEVICE_UNKNOWN);
     $current_date = date('Y-m-d H:i:s');
     $this->date_modified = $current_date;
     $this->date_created = $current_date;
     if ($this->device_type == CONSTANTS::DEVICE_UNKNOWN) {
         $this->notification = 0;
     } else {
         $this->disableSameDeviceId($this->device_id);
         $this->notification = 1;
     }
     try {
         $this->save();
     } catch (\Exception $e) {
         throw $e;
     }
     return $this;
 }
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
$result = getMedicationData();
$value = sqlFetchArray($result);
do {
    $e_Medication = $ccr->createElement('Medication');
    $e_Medications->appendChild($e_Medication);
    $e_CCRDataObjectID = $ccr->createElement('CCRDataObjectID', getUuid());
    $e_Medication->appendChild($e_CCRDataObjectID);
    $e_DateTime = $ccr->createElement('DateTime');
    $e_Medication->appendChild($e_DateTime);
    $date = date_create($value['date_added']);
    $e_ExactDateTime = $ccr->createElement('ExactDateTime', $date->format('Y-m-d\\TH:i:s\\Z'));
    $e_DateTime->appendChild($e_ExactDateTime);
    $e_Type = $ccr->createElement('Type');
    $e_Medication->appendChild($e_Type);
    $e_Text = $ccr->createElement('Text', 'Medication');
    $e_Type->appendChild($e_Text);
    $e_Status = $ccr->createElement('Status');
    $e_Medication->appendChild($e_Status);
    $e_Text = $ccr->createElement('Text', $value['active']);
    $e_Status->appendChild($e_Text);
    $e_Medication->appendChild(sourceType($ccr, $sourceID));
function patCharactersticQRDA($xml, $patient_id)
{
    //Patient History
    $patHist = patientQRDAHistory($patient_id);
    $tobaccoArr = explode('|', $patHist['tobacco']);
    $query = sqlQuery("select codes from list_options where list_id ='smoking_status' and option_id = ?", array($tobaccoArr[3]));
    $tobacco = explode(':', $query['codes']);
    $tobacco_code = $tobacco[1];
    $vset = sqlQuery("select * from valueset where code = ? and nqf_code = ?", array($tobacco_code, $xml->nqf_code));
    if (!empty($vset['valueset'])) {
        //Entry open
        $xml->open_entry();
        //observation Open
        $xml->open_customTag('observation', array('classCode' => 'OBS', 'moodCode' => 'EVN'));
        $tempID = "2.16.840.1.113883.10.20.22.4.85";
        $xml->self_templateid($tempID);
        $actId = getUuid();
        $xml->self_customId($actId);
        $arr = array('code' => 'ASSERTION', 'displayName' => 'Assertion', 'codeSystem' => '2.16.840.1.113883.5.4', 'codeSystemName' => 'ActCode');
        $xml->self_codeCustom($arr);
        $arr = array('code' => 'completed');
        $xml->self_customTag('statusCode', $arr);
        $timeArr = array('low' => date('Ymdhis', strtotime($patHist['date'])), 'high' => date('Ymdhis', strtotime($patHist['date'])));
        $xml->add_entryEffectTime($timeArr);
        $xml->self_customTag('value', array('xsi:type' => 'CD', 'code' => $vset['code'], 'codeSystem' => $vset['code_system'], 'sdtc:valueSet' => $vset['valueset']));
        //observation Close
        $xml->close_customTag();
        //Entry close
        $xml->close_entry();
    }
}
Пример #21
0
<?php

require_once 'asset/smarty-3.1.28/libs/Smarty.class.php';
require_once 'common/config/conf.php';
require_once 'common/functions.php';
require_once 'vendor/mysql.php';
require_once 'vendor/page.php';
require_once 'common/smarty.inc.php';
$dbh = mysql::getInstance();
if ($_POST) {
    $data['id'] = getUuid();
    $data['comment_post_id'] = intval($_POST['comment_post_id']);
    $data['comment_author'] = $_POST['comment_author'];
    $data['comment_content'] = $_POST['comment_content'];
    $dbh->insert('blog_comments', $data);
    header('Location: http://' . $_SERVER['HTTP_HOST'] . '/blog/post.php?post_id=' . $data['comment_post_id']);
    //var_dump($data);
}
Пример #22
0
 private function setRecordsValues()
 {
     $mode_md = FALSE;
     if (count($this->md_head) > 0) {
         $md_record = new MdRecord();
         $md_record->setReportValidType($this->report_valid_type['type'], $this->report_valid_type['short']);
         $md_record->setTableMode($this->table_mode);
         foreach ($this->md_head as $key => $md) {
             if ($this->table_mode == 'md' && canActionAcl('mds', $this->md_head[$key]['iso'], 'w') === FALSE) {
                 $this->md_head[$key]['action'] = 'skip';
                 $this->md_head[$key]['right'] = 'x';
                 $this->setReport($key, 'error', labelTranslation(MICKA_LANG, 'guest not right'));
                 continue;
             }
             $this->md_head[$key]['ok'] = 0;
             $md_record->setRecordImporting(FALSE);
             $this->addLogImport('setRecordsValues.MD', $md);
             // zaznam existuje
             if ($md['uuid'] != '') {
                 if ($this->micka_lite) {
                     $md_record->setTableMode('tmp');
                 } else {
                     $md_record->setTableMode('md');
                     $mode_md = TRUE;
                 }
                 $record = $md_record->getMd('uuid', $md['uuid']);
                 if ($mode_md === TRUE && $record['report'] == 'ok' && $record['right'] == 'w') {
                     $this->setReport($key, 'error', "INFO: " . labelTranslation(MICKA_LANG, 'The metadata record already exists. It will be replaced with the new one when you save it.'));
                 }
                 if ($this->micka_lite) {
                     $record_orig = $record;
                 } else {
                     $md_record->setTableMode($this->table_mode);
                     $record_orig = $md_record->getMd('uuid', $md['uuid']);
                 }
                 $this->addLogImport('setRecordsValues.origMD', $record_orig);
                 $this->addLogImport('setRecordsValues.table_mode', $this->table_mode);
                 if ($this->table_mode == 'tmp' && canActionAcl('mds', $this->md_head[$key]['iso'], 'w') === FALSE) {
                     if ($record_orig['report'] == 'ok' && $record_orig['report'] == 'ok') {
                         $this->md_head[$key]['action'] = 'update';
                         $this->md_head[$key]['recno'] = isset($record_orig['md']['RECNO']) && $record_orig['md']['RECNO'] > 0 ? $record_orig['md']['RECNO'] : -1;
                     } else {
                         $this->md_head[$key]['action'] = 'insert';
                     }
                     $this->md_head[$key]['right'] = 'w';
                 } elseif ($record['report'] == 'ok' && $record['right'] != 'w') {
                     $this->md_head[$key]['action'] = 'skip';
                     $this->md_head[$key]['right'] = 'x';
                     $this->setReport($key, 'error', labelTranslation(MICKA_LANG, 'Record exists, import cancelled. No update rights.'));
                 } elseif ($record['report'] == 'Not rights' && $record['right'] == 'x') {
                     $this->md_head[$key]['action'] = 'skip';
                     $this->md_head[$key]['right'] = 'x';
                     $this->setReport($key, 'error', labelTranslation(MICKA_LANG, 'Record exists, import cancelled. No update rights.'));
                 } elseif ($record['report'] == 'ok' && $record['right'] == 'w') {
                     if ($this->action == 'skip') {
                         $this->md_head[$key]['action'] = 'skip';
                         $this->md_head[$key]['right'] = 'w';
                         $this->setReport($key, 'error', labelTranslation(MICKA_LANG, 'Record exists, import cancelled.'));
                     } else {
                         // update
                         if ($record_orig['report'] == 'Record not found') {
                             // nový záznam v tmp
                             $this->md_head[$key]['action'] = 'insert';
                             $this->md_head[$key]['right'] = 'w';
                         } else {
                             $this->md_head[$key]['recno'] = isset($record_orig['md']['RECNO']) && $record_orig['md']['RECNO'] > 0 ? $record_orig['md']['RECNO'] : -1;
                             $this->md_head[$key]['action'] = 'update';
                             $this->md_head[$key]['right'] = 'w';
                             //$this->md_head[$key]['report'] = '';
                             //$this->setReport($key, 'error', "INFO: " . labelTranslation(MICKA_LANG, 'The metadata record already exists. It will be replaced with the new one when you save it.'));
                             $md['langs'] = $this->table_mode == 'tmp' ? getUniqueMdLangs($md['langs'], $record_orig['md']['LANG']) : $md['langs'];
                             $this->data_type = $this->data_type == -100 ? $record_orig['md']['DATA_TYPE'] : $this->data_type;
                         }
                     }
                 } elseif ($record['report'] == 'Record not found') {
                     $this->md_head[$key]['action'] = 'insert';
                     $this->md_head[$key]['right'] = 'w';
                 } else {
                     $this->md_head[$key]['action'] = 'skip';
                     $this->md_head[$key]['right'] = 'x';
                     $this->setReport($key, 'error', labelTranslation(MICKA_LANG, 'unknow error in MD'));
                 }
             } else {
                 // Nový záznam
                 $this->md_head[$key]['action'] = 'insert';
                 $this->md_head[$key]['right'] = 'w';
             }
             // akce
             $data = array();
             switch ($md['iso']) {
                 case 'MD':
                     $data['md_standard'] = 0;
                     break;
                 case 'MS':
                 case 'MC':
                     $data['md_standard'] = 10;
                     break;
                 case 'DC':
                     $data['md_standard'] = 1;
                     break;
                 case 'FC':
                     $data['md_standard'] = 2;
                     break;
                 default:
                     $data['md_standard'] = $this->mds;
             }
             $data['lang'] = $md['langs'];
             $data['server_name'] = $this->server_name;
             if ($this->md_head[$key]['action'] == 'insert') {
                 // vytvoření záznamu v tabulce [md]
                 if ($md['uuid'] != '') {
                     $data['uuid'] = $md['uuid'];
                 } else {
                     $data['uuid'] = getUuid();
                     $this->md_head[$key]['uuid'] = $data['uuid'];
                 }
                 $data['edit_group'] = $this->group_e != '' ? $this->group_e : $this->user;
                 $data['view_group'] = $this->group_v != '' ? $this->group_v : $this->user;
                 $data['data_type'] = $this->data_type == -100 ? -1 : $this->data_type;
                 if ($this->table_mode == 'md') {
                     $this->md_head[$key]['recno'] = $md_record->setNewRecordMd($data, $md['lang'], $import = TRUE);
                 } else {
                     $this->md_head[$key]['recno'] = $md_record->setNewRecord($data, $md['lang'], $import = TRUE);
                 }
             } elseif ($this->md_head[$key]['action'] == 'update' && $this->md_head[$key]['recno'] > 0) {
                 // Aktualizace [md]
                 if ($this->micka_lite === TRUE) {
                     if (array_key_exists('lang', $data) === TRUE) {
                         unset($data['lang']);
                     }
                 }
                 if ($this->micka_lite === FALSE) {
                     $data['data_type'] = $this->data_type;
                 }
                 $md_record->updateMdFromImport($this->md_head[$key]['recno'], $data);
                 // Smazání [md_values]
                 if ($this->micka_lite) {
                     $md_record->deleteMdIdFromMdValues($this->md_head[$key]['recno'], $md['langs'], $this->del_md_id[$key]);
                 } else {
                     $md_record->deleteMdValuesBeforeImport($this->md_head[$key]['recno']);
                 }
             }
             if ($this->md_head[$key]['action'] == 'insert' || $this->md_head[$key]['action'] == 'update') {
                 // Vložení nových hodnot
                 if ($this->md_head[$key]['recno'] > 0) {
                     $data = array();
                     foreach ($this->md_values[$key] as $md_values) {
                         $md_values['recno'] = $this->md_head[$key]['recno'];
                         if ($this->micka_lite === TRUE && isset($record_orig['md']['LANG']) && $md_values['lang'] != 'xxx') {
                             // pokud byl odstraněn nějaký jazyk, odstranit i data
                             if (strpos($record_orig['md']['LANG'], $md_values['lang']) !== FALSE) {
                                 array_push($data, $md_values);
                             }
                         } else {
                             array_push($data, $md_values);
                         }
                     }
                     if ($this->micka_lite === FALSE) {
                         // zachovat původní datestamp
                         $md_record->setRecordImporting(TRUE);
                     }
                     $md_record->setMdValues($data);
                     $this->md_head[$key]['ok'] = 1;
                     $this->md_head[$key]['valid'] = $md_record->getReportValid();
                 }
             }
         }
     }
 }