function envoismail($sujetmail, $text, $destinataire, $expediteur, $paramTypeMail = null, $conf = null)
{
    if ($conf == null) {
        $globalConfig = new GlobalConfig();
    }
    if ($globalConfig->getConf()->getSmtpServiceEnable() == TRUE) {
        /*
         * Toutes les adresses emails sont redirigées vers utilisateurs.fta@ldc.fr
         * Si la redirection est mis en place
         */
        if ($globalConfig->getConf()->getSmtpEmailRedirectionUser()) {
            $destinataire_orig = $destinataire;
            $destinataire = $globalConfig->getConf()->getSmtpEmailRedirectionUser();
            $sujetmail_orig = $sujetmail;
            $sujetmail = "[Environnement " . $globalConfig->getConf()->getExecEnvironment() . "] " . $sujetmail_orig;
            $text_orig = $text;
            if (is_array($destinataire_orig)) {
                $listeDesDestinataire = explode(",", $destinataire_orig);
            } else {
                $listeDesDestinataire = $destinataire_orig;
            }
            $text = $listeDesDestinataire . "\n" . $text_orig;
        }
        //Création du mail
        $mail = new htmlMimeMail5();
        $mail->setSMTPParams($globalConfig->getConf()->getSmtpServerName());
        // Set the From and Reply-To headers
        $mail->setFrom($expediteur);
        $mail->setReturnPath($expediteur);
        // Set the Subject
        $mail->setSubject($sujetmail);
        /**
         * Encodement en utf-8
         */
        $mail->setTextCharset("UTF-8");
        $mail->setHTMLCharset("UTF-8");
        $mail->setHeadCharset("UTF-8");
        // Set the body
        $mail->setHTML(nl2br($text));
        //$result = $mail->send(array($adresse_to), 'smtp');
        //$result = $mail->send(array($destinataire), 'smtp');
        /**
         * L'envoi réel du mail n'est pas réalisé en environnement Codeur
         */
        if ($paramTypeMail != "mail-transactions") {
            $result = $mail->send(array($destinataire), 'smtp');
        }
        if (!$result and $globalConfig->getConf()->getExecEnvironment() == EnvironmentConf::ENV_PRD) {
            $paramTypeMail = "Erreur";
        }
    }
    /**
     * Génération de log
     */
    $paramLog = $paramTypeMail . " " . $expediteur . " " . $destinataire . "\n" . $sujetmail . "\n" . $text;
    //    Logger::AddMail($paramLog, $paramTypeMail);
}
 /**
  * SimpleViewの新しいインスタンスを返す
  * 
  * @since 06/08/18 17:03
  * @param  object    $skeleton
  * @param  String    $outputEncoding
  * @return SimpleView
  */
 function &_createSimpleView(&$skeleton, $outputEncoding)
 {
     $view =& new SimpleView();
     $view->outputEncoding = $this->config->getValue($outputEncoding);
     $view->templateEncoding = SKELETON_CODE;
     $view->assignByRef('skeleton', $skeleton);
     $view->assign('author', $this->config->getValue('generator.author', ''));
     $view->assign('license', $this->config->getValue('generator.license', ''));
     $view->assign('copyright', $this->config->getValue('generator.copyright', ''));
     return $view;
 }
 /**
  * On vérifie si l'utilisateur connecter est le propriétaire de la transaction en cours.
  * @return boolean
  */
 function isEditableNotificationMail()
 {
     $globalConf = new GlobalConfig();
     $idUser = $globalConf->getAuthenticatedUser()->getKeyValue();
     $idUserRegister = $this->getDataField(self::FIELDNAME_ID_USER)->getFieldValue();
     if ($idUser == $idUserRegister) {
         $isEditable = Chapitre::EDITABLE;
     } else {
         $isEditable = Chapitre::NOT_EDITABLE;
     }
     return $isEditable;
 }
Example #4
0
 public function createTransOrderForBatch($fields)
 {
     $longId = CommonUtil::longId();
     //$batchNo = $longId . sprintf('%03s', $fields['channel']) . sprintf('%02s', $fields['gateway']) . mt_rand(100, 999) ;
     $batchNo = date('ymdHis') . mt_rand(100, 999);
     $requestData = json_decode($fields['request_data'], true);
     foreach ($requestData as $field) {
         if (!in_array($fields['gateway'], $this->_allowTransGateway)) {
             throw new PayException(ErrorCode::ERR_GATEWAY_FAIL, '该gateway不允许提现');
         }
         $validation = new TransValidator($field);
         if (!$validation->passes(TransValidator::$transDetailRule)) {
             throw new PayException(ErrCode::ERR_PARAM, $validation->errors);
         }
         if ($fields['gateway'] == PayVars::GATEWAY_YEEPAY) {
             if (!isset($field['bank_code']) || !isset(PayBankVars::$yeepayBankAlis[$field['bank_code']])) {
                 throw new PayException(ErrCode::ERR_PARAM, '银行编码错误!');
             }
         }
         $account = AccountBiz::getInstance()->getOrCreateAccount($field['user_id'], $fields['channel']);
         $primaryId = CommonUtil::LongIdIncrease($longId);
         $merTransNo = $primaryId;
         $insertArr[] = ['id' => $primaryId, 'user_id' => $field['user_id'], 'account_id' => $account['id'], 'mer_trans_no' => null !== ($localEnv = \GlobalConfig::getLocalEnv()) ? $merTransNo . $localEnv : $merTransNo, 'batch_no' => $batchNo, 'trans_amount' => $field['trans_amount'], 'create_time' => time(), 'person_name' => $field['user_name'], 'person_account' => $field['user_account'], 'channel' => $fields['channel'], 'gateway' => $fields['gateway'], 'callback_url' => $fields['callback_url'], 'subject' => $fields['subject'], 'body' => isset($field['body']) ? $field['body'] : '', 'mobile_no' => isset($field['mobile']) ? $field['mobile'] : '', 'bank_code' => isset($field['bank_code']) ? $field['bank_code'] : '', 'busi_trans_no' => isset($field['busi_trans_no']) ? $field['busi_trans_no'] : ''];
     }
     $trans = new TransModel();
     if (true !== $trans->insert($insertArr)) {
         throw new PayException(ErrCode::ERR_SYSTEM, '数据库保存失败');
     }
     return $batchNo;
 }
Example #5
0
 public function createRefundOrder($fields)
 {
     $account = AccountBiz::getInstance()->getOrCreateAccount($fields['user_id'], $fields['channel']);
     $refund = new RefundModel();
     $refund->id = CommonUtil::longId();
     $refund->user_id = $fields['user_id'];
     $refund->account_id = $account['id'];
     $refund->channel = $fields['channel'];
     $refund->gateway = $fields['gateway'];
     $refund->recharge_id = $fields['recharge_id'];
     $refund->mer_refund_no = $refund->id . substr(sprintf('%012s', $fields['user_id']), -12);
     if (null !== ($localEnv = \GlobalConfig::getLocalEnv())) {
         $refund->mer_refund_no = substr($refund->mer_refund_no, 0, -strlen($localEnv)) . $localEnv;
     }
     $refund->amount = $fields['refund_amount'];
     $refund->create_time = time();
     $refund->callback_url = $fields['callback_url'];
     $refund->subject = $fields['subject'];
     $refund->body = isset($fields['body']) ? $fields['body'] : '';
     $refund->busi_refund_no = isset($fields['busi_refund_no']) ? $fields['busi_refund_no'] : '';
     $refund->seller_partner = isset($fields['seller_partner']) ? $fields['seller_partner'] : '';
     if (true !== $refund->save()) {
         throw new PayException(ErrCode::ERR_ORDER_CREATE_FAIL);
     }
     return $refund;
 }
 function __construct()
 {
     $globalConfig = new GlobalConfig();
     try {
         parent::__construct(GlobalConfig::MYSQL_HOST . $globalConfig->getConf()->getMysqlServerName() . GlobalConfig::MYSQL_DBNAME . $globalConfig->getConf()->getMysqlDatabaseName(), $globalConfig->getConf()->getMysqlDatabaseAuthentificationUsername(), $globalConfig->getConf()->getMysqlDatabaseAuthentificationPassword(), array(PDO::ATTR_PERSISTENT => true));
         /**
          * PDO définit simplement le code d'erreur à inspecter
          * et il émettra un message E_WARNING traditionnel
          */
         $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
         $this->exec('SET NAMES utf8');
     } catch (PDOException $e) {
         die('Erreur : ' . $e->getMessage());
     }
     //  $this->setPdoObjet($globalConfig->getDatabaseConnexion());
 }
Example #7
0
 public function createRechargeOrder($fields)
 {
     $account = AccountBiz::getInstance()->getOrCreateAccount($fields['user_id'], $fields['channel']);
     $primaryId = $this->_rechargeModel->calculPrimaryId();
     $this->_rechargeModel->id = $primaryId;
     $this->_rechargeModel->user_id = $fields['user_id'];
     $this->_rechargeModel->account_id = $account['id'];
     $this->_rechargeModel->channel = $fields['channel'];
     $this->_rechargeModel->gateway = $fields['gateway'];
     $this->_rechargeModel->mer_recharge_no = $primaryId . substr(sprintf('%012s', $fields['user_id']), -12);
     if (null !== ($localEnv = \GlobalConfig::getLocalEnv())) {
         $this->_rechargeModel->mer_recharge_no = substr($this->_rechargeModel->mer_recharge_no, 0, -strlen($localEnv)) . $localEnv;
     }
     $this->_rechargeModel->recharge_amount = $fields['recharge_amount'];
     $this->_rechargeModel->create_time = time();
     $this->_rechargeModel->return_url = $fields['return_url'];
     $this->_rechargeModel->callback_url = $fields['callback_url'];
     $this->_rechargeModel->subject = $fields['subject'];
     $this->_rechargeModel->expire_time = isset($fields['expire_time']) ? $fields['expire_time'] : 0;
     $this->_rechargeModel->consume_id = isset($fields['consume_id']) ? $fields['consume_id'] : '';
     $this->_rechargeModel->body = isset($fields['body']) ? $fields['body'] : '';
     $this->_rechargeModel->city_id = isset($fields['city_id']) ? $fields['city_id'] : 0;
     $this->_rechargeModel->plat = isset($fields['plat']) ? $fields['plat'] : 1;
     $this->_rechargeModel->plat_ext = isset($fields['plat_ext']) ? $fields['plat_ext'] : '';
     $this->_rechargeModel->mobile_no = isset($fields['mobile']) ? $fields['mobile'] : '';
     $this->_rechargeModel->bank_code = isset($fields['bank_code']) ? $fields['bank_code'] : '';
     $this->_rechargeModel->busi_recharge_no = isset($fields['busi_recharge_no']) ? $fields['busi_recharge_no'] : '';
     $this->_rechargeModel->gateway_account = $fields['gateway'] == PayVars::GATEWAY_WECHAT && isset($fields['open_id']) ? $fields['open_id'] : '';
     if (true !== $this->_rechargeModel->save()) {
         throw new PayException(ErrCode::ERR_ORDER_CREATE_FAIL);
     }
     return $this->_rechargeModel;
 }
function func(GearmanJob $job)
{
    $data = json_decode($job->workload(), true);
    // 临时关闭Logger
    $tmpEnable = GlobalConfig::$LOGGER_ENABLE;
    GlobalConfig::$LOGGER_ENABLE = false;
    LoggerInterface::save($data);
    GlobalConfig::$LOGGER_ENABLE = $tmpEnable;
}
 function wso_g002($startDate, $endDate)
 {
     if ($this->isInit) {
         parent::clearParamsData();
         parent::addParamData("action", "get_stock_article");
         parent::addParamData('code_depot', GlobalConfig::getDepositCode());
         parent::addParamData('date_debut', $startDate);
         parent::addParamData('date_fin', $endDate);
         return parent::doRequest("GET");
     }
 }
Example #10
0
 /**
  * Initializes the controller to be tested and clears all previous
  * authentication as well as output variable assignments
  *
  * @param string name of controller class (ex AccountController)
  * @param bool true to clear all authentication
  */
 function InitController($classname, $clearAuth = true)
 {
     $gc = GlobalConfig::GetInstance();
     eval('$this->controller = new ' . $classname . '($this->phreezer, $this->renderEngine, $gc->GetContext(), $this->router );');
     $this->controller->UnitTestMode = true;
     $this->controller->CaptureOutputMode = true;
     // clear all previous input
     $this->InputClearAll();
     // remove any authentication that was hanging around
     if ($clearAuth) {
         $this->ClearCurrentUser();
     }
     // get rid of any feedback or warnings
     $this->renderEngine->clear("warning");
     $this->renderEngine->clear("feedback");
     $this->overrideController->OverrideSetContext("feedback", "");
     $this->Println("-- Controller '{$classname}' initialized");
 }
Example #11
0
 private static function insert($tag, $level, $msg)
 {
     // 是否需要Logger
     if (!GlobalConfig::$LOGGER_ENABLE) {
         return;
     }
     // 临时关闭Logger
     $tmpEnable = GlobalConfig::$LOGGER_ENABLE;
     GlobalConfig::$LOGGER_ENABLE = false;
     // 校验tag
     $tags = LoggerKeys::$allTags;
     if (!in_array($tag, $tags)) {
         throw new LibraryException("TAG:{$tag} 需要在LoggerKeys中定义!");
     }
     // 获取错误信息
     if (is_subclass_of($msg, 'Exception')) {
         $traceList = $msg->getTrace();
         $message = $msg->getMessage();
         $traceInfo = $traceList[0];
         $loc = $traceInfo['file'] . ':' . $traceInfo['line'];
     } else {
         $traceList = debug_backtrace();
         $message = $msg;
         $traceInfo = $traceList[1];
         $loc = $traceInfo['file'] . ':' . $traceInfo['line'];
     }
     $now = time();
     $data = array('create_time' => $now, 'update_time' => $now, 'tag' => $tag, 'level' => $level, 'client_ip' => Http::getClientIp(), 'client_port' => Http::getClientPort(), 'server_ip' => Http::getServerIp(), 'server_port' => Http::getServerPort(), 'url' => Url::getCurrentUrl(), 'post' => json_encode($_POST), 'loc' => $loc, 'message' => $message, 'trace' => json_encode($traceList));
     if (GlobalConfig::$LOGGER_ASYNC) {
         $gearman = GearmanPool::getClient(GearmanConfig::$SERVER_COMMON);
         $gearman->doBackground('logger_async', json_encode($data));
     } else {
         LoggerInterface::save($data);
     }
     GlobalConfig::$LOGGER_ENABLE = $tmpEnable;
 }
Example #12
0
/**
 * SESSION CLASSES
 * Any classes that will be stored in the session can be added here
 * and will be pre-loaded on every page
 */
require_once "Model/User.php";
/**
 * RENDER ENGINE
 * You can use any template system that implements
 * IRenderEngine for the view layer.  Phreeze provides pre-built
 * implementations for Smarty, Savant, Blade and plain PHP.
 */
require_once 'verysimple/Phreeze/BladeRenderEngine.php';
GlobalConfig::$TEMPLATE_ENGINE = 'BladeRenderEngine';
GlobalConfig::$TEMPLATE_PATH = GlobalConfig::$APP_ROOT . '/views/';
GlobalConfig::$TEMPLATE_CACHE_PATH = GlobalConfig::$APP_ROOT . '/storage/';
/**
 * ROUTE MAP
 * The route map connects URLs to Controller+Method and additionally maps the
 * wildcards to a named parameter so that they are accessible inside the
 * Controller without having to parse the URL for parameters such as IDs
 */
GlobalConfig::$ROUTE_MAP = array('GET:' => array('route' => 'Default.Home'), 'GET:loginform' => array('route' => 'Secure.LoginForm'), 'POST:login' => array('route' => 'Secure.Login'), 'GET:secureuser' => array('route' => 'Secure.UserPage'), 'GET:secureadmin' => array('route' => 'Secure.AdminPage'), 'GET:logout' => array('route' => 'Secure.Logout'), 'GET:roles' => array('route' => 'Role.ListView'), 'GET:role/(:num)' => array('route' => 'Role.SingleView', 'params' => array('id' => 1)), 'GET:api/roles' => array('route' => 'Role.Query'), 'POST:api/role' => array('route' => 'Role.Create'), 'GET:api/role/(:num)' => array('route' => 'Role.Read', 'params' => array('id' => 2)), 'PUT:api/role/(:num)' => array('route' => 'Role.Update', 'params' => array('id' => 2)), 'DELETE:api/role/(:num)' => array('route' => 'Role.Delete', 'params' => array('id' => 2)), 'GET:users' => array('route' => 'User.ListView'), 'GET:user/(:num)' => array('route' => 'User.SingleView', 'params' => array('id' => 1)), 'GET:api/users' => array('route' => 'User.Query'), 'POST:api/user' => array('route' => 'User.Create'), 'GET:api/user/(:num)' => array('route' => 'User.Read', 'params' => array('id' => 2)), 'PUT:api/user/(:num)' => array('route' => 'User.Update', 'params' => array('id' => 2)), 'DELETE:api/user/(:num)' => array('route' => 'User.Delete', 'params' => array('id' => 2)), 'GET:imovels' => array('route' => 'Imovel.ListView'), 'GET:imovel/(:num)' => array('route' => 'Imovel.SingleView', 'params' => array('id' => 1)), 'GET:api/imovels' => array('route' => 'Imovel.Query'), 'POST:api/imovel' => array('route' => 'Imovel.Create'), 'GET:api/imovel/(:num)' => array('route' => 'Imovel.Read', 'params' => array('id' => 2)), 'PUT:api/imovel/(:num)' => array('route' => 'Imovel.Update', 'params' => array('id' => 2)), 'DELETE:api/imovel/(:num)' => array('route' => 'Imovel.Delete', 'params' => array('id' => 2)), 'GET:tipoimovels' => array('route' => 'TipoImovel.ListView'), 'GET:tipoimovel/(:num)' => array('route' => 'TipoImovel.SingleView', 'params' => array('id' => 1)), 'GET:api/tipoimovels' => array('route' => 'TipoImovel.Query'), 'POST:api/tipoimovel' => array('route' => 'TipoImovel.Create'), 'GET:api/tipoimovel/(:num)' => array('route' => 'TipoImovel.Read', 'params' => array('id' => 2)), 'PUT:api/tipoimovel/(:num)' => array('route' => 'TipoImovel.Update', 'params' => array('id' => 2)), 'DELETE:api/tipoimovel/(:num)' => array('route' => 'TipoImovel.Delete', 'params' => array('id' => 2)), 'GET:api/(:any)' => array('route' => 'Default.ErrorApi404'), 'PUT:api/(:any)' => array('route' => 'Default.ErrorApi404'), 'POST:api/(:any)' => array('route' => 'Default.ErrorApi404'), 'DELETE:api/(:any)' => array('route' => 'Default.ErrorApi404'));
/**
 * FETCHING STRATEGY
 * You may uncomment any of the lines below to specify always eager fetching.
 * Alternatively, you can copy/paste to a specific page for one-time eager fetching
 * If you paste into a controller method, replace $G_PHREEZER with $this->Phreezer
 */
// $GlobalConfig->GetInstance()->GetPhreezer()->SetLoadType("Imovel","fk_imovel_tipo_imovel1",KM_LOAD_EAGER); // KM_LOAD_INNER | KM_LOAD_EAGER | KM_LOAD_LAZY
// $GlobalConfig->GetInstance()->GetPhreezer()->SetLoadType("User","fk_user_role",KM_LOAD_EAGER); // KM_LOAD_INNER | KM_LOAD_EAGER | KM_LOAD_LAZY
    /**
     * Displays the GUI input form
     */
    function display()
    {
        global $db, $sid, $lang, $root_path, $pid, $insurance_show, $user_id, $mode, $dbtype, $no_tribe, $no_region, $update, $photo_filename;
        #, $_FILES $_POST, $_SESSION;
        extract($_POST);
        require_once $root_path . 'include/care_api_classes/class_advanced_search.php';
        # Load the language tables
        $lang_tables = $this->langfiles;
        include $root_path . 'include/inc_load_lang_tables.php';
        include_once $root_path . 'include/inc_date_format_functions.php';
        include_once $root_path . 'include/care_api_classes/class_insurance.php';
        include_once $root_path . 'include/care_api_classes/class_person.php';
        $db->debug = FALSE;
        # Create the new person object
        $person_obj =& new Person($pid);
        # Create a new person insurance object
        $pinsure_obj =& new PersonInsurance($pid);
        if (!isset($insurance_show)) {
            $insurance_show = TRUE;
        }
        $newdata = 1;
        $error = 0;
        $dbtable = 'care_person';
        if (!isset($photo_filename) || empty($photo_filename)) {
            $photo_filename = 'nopic';
        }
        # Assume first that image is not uploaded
        $valid_image = FALSE;
        //* Get the global config for person's registration form*/
        include_once $root_path . 'include/care_api_classes/class_globalconfig.php';
        $glob_obj = new GlobalConfig($GLOBAL_CONFIG);
        $glob_obj->getConfig('person_%');
        extract($GLOBAL_CONFIG);
        # Check whether config foto path exists, else use default path
        $photo_path = is_dir($root_path . $GLOBAL_CONFIG['person_foto_path']) ? $GLOBAL_CONFIG['person_foto_path'] : $this->default_photo_path;
        if ($mode == 'save' || $mode == 'forcesave') {
            $search_obj =& new advanced_search();
            if (is_array($result_array = $search_obj->get_equal_words("tribe_name", "care_tz_tribes", false, 65, 'tribe_id')) && $name_maiden && !$no_tribe) {
                $tribe_array = $result_array;
            } else {
                $tribe_array = $result_array;
            }
            if (is_array($result_array = $search_obj->get_equal_words("name", "care_tz_religion", false, 65, 'nr')) && $religion && !$person_religion_hide) {
                $religion_array = $result_array;
            } else {
                $religion_array = $result_array;
            }
            /*
            		if (is_array($result_array=$search_obj->get_equal_words("region_name", "care_tz_region", false, 65, 'region_id')) && $email && !$person_email_hide )
            		{
            			$region_array=$result_array;
            		}
            		else
            		{
            			 $region_array=$result_array;
            		}
            		if (is_array($result_array=$search_obj->get_equal_words1("district_name", "care_tz_district", false, 65, 'district_id',$email)) && $sss_nr )
            		{
            			$district_array=$result_array;
            		}
            		else
            		{
            			 $district_array=$result_array;
            		}
            		if (is_array($result_array=$search_obj->get_equal_words1("ward_name", "care_tz_ward", false, 65, 'ward_id',$sss_nr)) && $nat_id_nr )
            		{
            			$ward_array=$result_array;
            		}
            		else
            		{
            			 $ward_array=$result_array;
            		}
            */
            # If saving is not forced, validate important elements
            if ($mode != 'forcesave') {
                # clean and check input data variables
                if (trim($encoder) == '') {
                    $encoder = $aufnahme_user;
                }
                if (trim($name_last) == '') {
                    $errornamelast = 1;
                    $error++;
                }
                //if (trim($selian_pid)=='' || !is_numeric($selian_pid) || (!$update && $person_obj->SelianFileExists($selian_pid))) { $errorfilenr=1; $error++;}
                if ($person_obj->IsHospitalFileNrMandatory()) {
                    if (trim($selian_pid) == '' || !$update && $person_obj->SelianFileExists($selian_pid)) {
                        $errorfilenr = 1;
                        $error++;
                    }
                }
                if (trim($name_first) == '') {
                    $errornamefirst = 1;
                    $error++;
                }
                if (trim($date_birth) == '') {
                    $errordatebirth = 1;
                    $error++;
                }
                if (mktime(0, 0, 0, substr($date_birth, 3, 2), substr($date_birth, 0, 2), substr($date_birth, 6, 4)) > time()) {
                    $errordatebirth = 1;
                    $error++;
                }
                //if (is_array($tribe_array) && !$no_tribe) {$errormaiden=1; $error++;}
                //if (is_array($town_array)) {$errortown=1; $error++;}
                //if (!$citizenship) { $errortown=1; $error++;}
                if ($sex == '') {
                    $errorsex = 1;
                    $error++;
                }
            }
            # If the validation produced no error, save the data
            if (!$error) {
                # Save the old filename for testing
                $old_fn = $photo_filename;
                # Create image object
                include_once $root_path . 'include/care_api_classes/class_image.php';
                $img_obj =& new Image();
                # Check the uploaded image file if exists and valid
                if ($img_obj->isValidUploadedImage($_FILES['photo_filename'])) {
                    $valid_image = TRUE;
                    # Get the file extension
                    $picext = $img_obj->UploadedImageMimeType();
                }
                //addr_citytown_nr='$addr_citytown_nr',
                if ($update) {
                    //echo formatDate2STD($geburtsdatum,$date_format);
                    $sql = "UPDATE {$dbtable} SET\n\t\t\t\t\t\t\t title='{$title}',\n\t\t\t\t\t\t\t selian_pid='{$selian_pid}',\n\t\t\t\t\t\t\t name_last='{$name_last}',\n\t\t\t\t\t\t\t name_first='{$name_first}',\n\t\t\t\t\t\t\t name_2='{$name_2}',\n\t\t\t\t\t\t\t name_3='{$name_3}',\n\t\t\t\t\t\t\t name_middle='{$name_middle}',\n\t\t\t\t\t\t\t name_maiden='{$name_maiden}',\n\t\t\t\t\t\t\t name_others='{$name_others}',\n\t\t\t\t\t\t\t date_birth='" . formatDate2STD($date_birth, $date_format) . "',\n\t\t\t\t\t\t\t blood_group='" . trim($blood_group) . "',\n\t\t\t\t\t\t\t rh='" . trim($rh) . "',\n\t\t\t\t\t\t\t sex='{$sex}',\n\t\t\t\t\t\t\t addr_str='{$addr_str}',\n\t\t\t\t\t\t\t addr_str_nr='{$addr_str_nr}',\n\t\t\t\t\t\t\t addr_zip='{$addr_zip}',\n\t\t\t\t\t\t\t addr_citytown_nr='{$addr_citytown_nr}',\n\t\t\t\t\t\t\t addr_citytown_name='{$addr_citytown_name}',\n\t\t\t\t\t\t\t phone_1_nr='{$phone_1_nr}',\n\t\t\t\t\t\t\t phone_2_nr='{$phone_2_nr}',\n\t\t\t\t\t\t\t cellphone_1_nr='{$cellphone_1_nr}',\n\t\t\t\t\t\t\t cellphone_2_nr='{$cellphone_2_nr}',\n\t\t\t\t\t\t\t fax='{$fax}',\n\t\t\t\t\t\t\t email='',\n\t\t\t\t\t\t\t citizenship ='{$citizenship}',\n\t\t\t\t\t\t\t civil_status='{$civil_status}',\n\t\t\t\t\t\t\t sss_nr='',\n\t\t\t\t\t\t\t nat_id_nr='',\n\t\t\t\t\t\t\t religion='{$religion}', insurance_ID='{$insurance_ID}',\n\t\t\t\t\t\t\t ethnic_orig='{$ethnic_orig}',\n\t\t\t\t\t\t\t date_update='" . date('Y-m-d H:i:s') . "',";
                    if ($region != "-1" && $district != "-1" && $ward != "-1") {
                        $sql .= "region='{$region}',\n\t\t\t\t\t\t\t   district='{$district}',\n\t\t\t\t\t\t\t   ward='{$ward}',";
                    }
                    //if ($old_fn!=$photo_filename){
                    if ($valid_image) {
                        # Compose the new filename
                        $photo_filename = $pid . '.' . $picext;
                        # Save the file
                        $img_obj->saveUploadedImage($_FILES['photo_filename'], $root_path . $photo_path . '/', $photo_filename);
                        # add to the sql query
                        $sql .= " photo_filename='{$photo_filename}',";
                    }
                    # complete the sql query
                    $sql .= " history=" . $person_obj->ConcatHistory("Update " . date('Y-m-d H:i:s') . " " . $_SESSION['sess_user_name'] . " \n") . ", modify_id='" . $_SESSION['sess_user_name'] . "' WHERE pid={$pid}";
                    //$db->debug=true;
                    $db->BeginTrans();
                    $ok = $db->Execute($sql);
                    if ($ok) {
                        $db->CommitTrans();
                        # Update the insurance data
                        # Lets detect if the data is already existing
                        if ($insurance_show) {
                            if ($insurance_item_nr) {
                                if (!empty($insurance_nr) && !empty($insurance_firm_name) && $insurance_firm_id) {
                                    $insure_data = array('insurance_nr' => $insurance_nr, 'firm_id' => $insurance_firm_id, 'class_nr' => $insurance_class_nr, 'history' => "Update " . date('Y-m-d H:i:s') . " " . $_SESSION['sess_user_name'] . " \n", 'modify_id' => $_SESSION['sess_user_name'], 'modify_time' => date('YmdHis'));
                                    $pinsure_obj->updateDataFromArray($insure_data, $insurance_item_nr);
                                }
                            } elseif ($insurance_nr && $insurance_firm_name && $insurance_class_nr) {
                                $insure_data = array('insurance_nr' => $insurance_nr, 'firm_id' => $insurance_firm_id, 'pid' => $pid, 'class_nr' => $insurance_class_nr, 'history' => "Update " . date('Y-m-d H:i:s') . " " . $_SESSION['sess_user_name'] . " \n", 'create_id' => $_SESSION['sess_user_name'], 'create_time' => date('YmdHis'));
                                $pinsure_obj->insertDataFromArray($insure_data);
                            }
                        }
                        $newdata = 1;
                        if (file_exists($this->displayfile)) {
                            header("location: {$this->displayfile}" . URL_REDIRECT_APPEND . "&pid={$pid}&from={$from}&newdata=1&target=entry");
                            exit;
                        } else {
                            echo "Error! Target display file not defined!!";
                        }
                    } else {
                        $db->RollbackTrans();
                    }
                } else {
                    $from = 'entry';
                    $_POST['date_birth'] = @formatDate2Std($date_birth, $date_format);
                    $_POST['date_reg'] = date('Y-m-d H:i:s');
                    $_POST['blood_group'] = trim($_POST['blood_group']);
                    $_POST['status'] = 'normal';
                    $_POST['history'] = "Init.reg. " . date('Y-m-d H:i:s') . " " . $_SESSION['sess_user_name'] . "\n";
                    //$_POST['modify_id']=$_SESSION['sess_user_name'];
                    $_POST['create_id'] = $_SESSION['sess_user_name'];
                    $_POST['create_time'] = date('YmdHis');
                    # Prepare internal data to be stored together with the user input data
                    if (!$person_obj->InitPIDExists($GLOBAL_CONFIG['person_id_nr_init'])) {
                        # If db is mysql, insert the initial pid value  from global config
                        # else let the dbms make an initial value via the sequence generator e.g. postgres
                        # However, the sequence generator must be configured during db creation to start at
                        # the initial value set in the global config
                        if ($dbtype == 'mysql') {
                            $_POST['pid'] = $GLOBAL_CONFIG['person_id_nr_init'];
                        }
                    } else {
                        # Persons are existing. Check if duplicate might exist
                        if (is_object($duperson = $person_obj->PIDbyData($_POST))) {
                            $error_person_exists = TRUE;
                        }
                    }
                    //echo $person_obj->getLastQuery();
                    if (!$error_person_exists || $mode == 'forcesave') {
                        if ($person_obj->insertDataFromInternalArray()) {
                            # If data was newly inserted, get the insert id if mysq, else get the pid number)
                            if (!$update) {
                                $oid = $db->Insert_ID();
                                $pid = $person_obj->LastInsertPK('pid', $oid);
                                /*
                                								if($dbtype=='mysql'){
                                									$pid=$db->Insert_ID();
                                								}else{
                                									$pid=$person_obj->postgre_Insert_ID($dbtable,'pid',$db->Insert_ID());
                                								}*/
                            }
                            //if(!$update) $pid=$db->Insert_ID();
                            # Save the valid uploaded photo
                            if ($valid_image) {
                                # Compose the new filename by joining the pid number and the file extension with "."
                                $photo_filename = $pid . '.' . $picext;
                                # Save the file
                                if ($img_obj->saveUploadedImage($_FILES['photo_filename'], $root_path . $photo_path . '/', $photo_filename)) {
                                    # Update the filename to the databank
                                    $person_obj->setPhotoFilename($pid, $photo_filename);
                                }
                            }
                            //echo $pid;
                            //echo $citizenship;
                            # Update the insurance data
                            # Lets detect if the data is already existing
                            if ($insurance_show) {
                                if ($insurance_item_nr) {
                                    if (!empty($insurance_nr) && !empty($insurance_firm_name) && $insurance_firm_id) {
                                        $insure_data = array('insurance_nr' => $insurance_nr, 'firm_id' => $insurance_firm_id, 'class_nr' => $insurance_class_nr);
                                        $pinsure_obj->updateDataFromArray($insure_data, $insurance_item_nr);
                                    }
                                } elseif ($insurance_nr && $insurance_firm_name && $insurance_class_nr) {
                                    $insure_data = array('insurance_nr' => $insurance_nr, 'firm_id' => $insurance_firm_id, 'pid' => $pid, 'class_nr' => $insurance_class_nr);
                                    $pinsure_obj->insertDataFromArray($insure_data);
                                }
                            }
                            $newdata = 1;
                            if (file_exists($this->displayfile)) {
                                header("location: {$this->displayfile}" . URL_REDIRECT_APPEND . "&pid={$pid}&from={$from}&newdata=1&target=entry");
                                exit;
                            } else {
                                echo "Error! Target display file not defined!!";
                            }
                        } else {
                            echo "<p>{$db->ErrorMsg}()<p>{$LDDbNoSave}";
                        }
                    }
                }
            }
            // end of if(!$error)
        } elseif (!empty($this->pid)) {
            # Get the person�s data
            if ($data_obj =& $person_obj->getAllInfoObject()) {
                $zeile = $data_obj->FetchRow();
                extract($zeile);
                //print_r($zeile);
                # Get the related insurance data
                $p_insurance =& $pinsure_obj->getPersonInsuranceObject($pid);
                if ($p_insurance == FALSE) {
                    $insurance_show = TRUE;
                } else {
                    if (!$p_insurance->RecordCount()) {
                        $insurance_show = TRUE;
                    } elseif ($p_insurance->RecordCount() == 1) {
                        $buffer = $p_insurance->FetchRow();
                        extract($buffer);
                        $insurance_show = TRUE;
                        $insurance_firm_name = $pinsure_obj->getFirmName($insurance_firm_id);
                    } else {
                        $insurance_show = FALSE;
                    }
                }
            }
        } else {
            $date_reg = date('Y-m-d H:i:s');
        }
        # Get the insurance classes
        $insurance_classes =& $pinsure_obj->getInsuranceClassInfoObject('class_nr,name,LD_var AS "LD_var"');
        include_once $root_path . 'include/inc_photo_filename_resolve.php';
        $search_obj =& new advanced_search();
        if (!$update) {
            $tribe = $name_maiden;
            $town = $citizenship;
        }
        if (is_array($result_array = $search_obj->get_equal_words("tribe_name", "care_tz_tribes", false, 65, 'tribe_id')) && $name_maiden && !$no_tribe) {
            $tribe_array = $result_array;
        } else {
            $tribe_array = $result_array;
        }
        /*
        		if (is_array($result_array=$search_obj->get_equal_words("village_name", "care_tz_village", false, 65, 'village_id',$ward)) && $addr_citytown_nr)
        		{
        			$town_array=$result_array;
        		}
        		else
        		{
        			 $town_array=$result_array;
        		}*/
        if (is_array($result_array = $search_obj->get_equal_words("name", "care_tz_religion", false, 65, 'nr')) && $religion) {
            $religion_array = $result_array;
        } else {
            $religion_array = $result_array;
        }
        /*
        		if (is_array($result_array=$search_obj->get_equal_words("region_name", "care_tz_region", false, 65, 'region_id')) && $email && !$person_email_hide )
        		{
        			$region_array=$result_array;
        		}
        		else
        		{
        			 $region_array=$result_array;
        		}
        		if (is_array($result_array=$search_obj->get_equal_words1("district_name", "care_tz_district", false, 65, 'district_id',$email)) && $sss_nr )
        		{
        			$district_array=$result_array;
        		}
        		else
        		{
        			 $district_array=$result_array;
        		}
        		if (is_array($result_array=$search_obj->get_equal_words1("ward_name", "care_tz_ward", false, 65, 'ward_id',$sss_nr)) && $nat_id_nr )
        		{
        			$ward_array=$result_array;
        		}
        
        		else
        		{
        			 $ward_array=$result_array;
        		}
        */
        ########  Here starts the GUI output #######################################################
        $img_male = createComIcon($root_path, 'spm.gif', '0');
        $img_female = createComIcon($root_path, 'spf.gif', '0');
        $tbg = 'background="' . $root_path . 'gui/img/common/' . $theme_com_icon . '/tableHeader_gr.gif"';
        if (!empty($this->pretext)) {
            echo $this->pretext;
        }
        ?>
		<script  language="javascript">
		<!--
			function test(){
			document.aufnahmeform.action="<?php 
        $_SERVER['PHP_SELF'];
        ?>
";
			document.aufnahmeform.submit();
		}

			function forceSave(){
			document.aufnahmeform.mode.value="forcesave";
			document.aufnahmeform.submit();
		}

		function showpic(d){
			if(d.value) document.images.headpic.src=d.value;
		}

		function popSearchWin(target,obj_val,obj_name){
			urlholder="./data_search.php<?php 
        echo URL_REDIRECT_APPEND;
        ?>
&target="+target+"&obj_val="+obj_val+"&obj_name="+obj_name;
			DSWIN<?php 
        echo $sid;
        ?>
=window.open(urlholder,"wblabel<?php 
        echo $sid;
        ?>
","menubar=no,width=400,height=550,resizable=yes,scrollbars=yes");
		}
		function list_popup(d,chosentype)
		{
			if(d.value=="notinlist")
			{
				urlholder="<?php 
        echo $root_path;
        ?>
modules/registration_admission/notinlist.php<?php 
        echo URL_APPEND . '&chosentype=" + chosentype + "';
        ?>
";
				notinlist=window.open(urlholder,"notinlist","width=500,height=450,menubar=no,resizable=yes,scrollbars=yes");
			}
		}
		function chkform(d) {
			<?php 
        if ($person_obj->IsHospitalFileNrMandatory()) {
            echo 'if(d.selian_pid.value==""){
			      			alert("Please enter Hospital File Number");
			      		 d.selian_pid.focus();
			      			return false;
			      			}else';
        }
        ?>

			if(d.name_last.value==""){
				alert("<?php 
        echo $LDPlsEnterLastName;
        ?>
");
				d.name_last.focus();
				return false;
			}else if(d.name_first.value==""){
				alert("<?php 
        echo $LDPlsEnterFirstName;
        ?>
");
				d.name_first.focus();
				return false;
			}else if(d.name_2.value==""){
				alert("<?php 
        echo 'Please Enter Father Name';
        ?>
");
				d.name_2.focus();
				return false;
			}else if(d.date_birth.value==""){
				alert("<?php 
        echo $LDPlsEnterDateBirth;
        ?>
");
				d.date_birth.focus();
				return false;
			}else if(d.sex[0]&&d.sex[1]&&!d.sex[0].checked&&!d.sex[1].checked){
				alert("<?php 
        echo $LDPlsSelectSex;
        ?>
");
				return false;

			<?php 
        if ($update) {
            $sql = "SELECT * FROM care_person where pid=" . $pid;
            $ergebnis = $db->Execute($sql);
            while ($person = $ergebnis->FetchRow()) {
                $region = $person['region'];
            }
        }
        if (!$update or $region == '') {
            echo '}else if(d.region.value=="-1"){';
            echo 'alert("Please select region");';
            echo 'd.region.focus();';
            echo 'return false;';
            echo '}else if(d.district.value=="-1"){';
            echo 'alert("Please select district");';
            echo 'd.district.focus();';
            echo 'return false;';
            echo '}else if(d.ward.value=="-1"){';
            echo ' alert("Please select Ward");';
            echo ' d.ward.focus();';
            echo ' return false;';
        } else {
            echo '}else if(d.region.value!="-1"){';
            echo 'if(d.district.value=="-1")';
            echo '{';
            echo 'alert("Please select district");';
            echo 'd.district.focus();';
            echo 'return false;';
            echo '}';
            echo 'if(d.ward.value=="-1")';
            echo '{';
            echo ' alert("Please select ward");';
            echo ' d.ward.focus();';
            echo ' return false;';
            echo '}';
        }
        ?>
			}else if(d.user_id.value==""){
				alert("<?php 
        echo $LDPlsEnterFullName;
        ?>
");
				d.user_id.focus();
				return false;
			}else if(d.name_maiden.value=="-1"){
				alert ("Select tribe!");
				return false;
			}else if(d.religion.value=="-1"){
				alert ("Select religion!");
				return false;
			}else{
				return true;
			}
		}


<?php 
        require $root_path . 'include/inc_checkdate_lang.php';
        ?>
		-->
		</script>

		<script language="javascript" src="<?php 
        echo $root_path;
        ?>
js/setdatetime.js"></script>
		<script language="javascript" src="<?php 
        echo $root_path;
        ?>
js/checkdate.js"></script>
		<script language="javascript" src="<?php 
        echo $root_path;
        ?>
js/dtpick_care2x.js"></script>

		<FONT    SIZE=-1  FACE="Arial">

		<form method="post" action="<?php 
        echo $thisfile;
        ?>
" name="aufnahmeform" ENCTYPE="multipart/form-data" onSubmit="return chkform(this)">

		<table border=0 cellspacing=0 cellpadding=0>
<?php 
        if ($error) {
            echo "<script language=\"Javascript\" type=\"text/javascript\"> </script>";
            //alert('Information is missing in the input field marked red!') ;
            ?>
			<tr bgcolor=#ffffee>
			<td colspan=3>
			<center>
				<font face=arial color=#7700ff size=4>
				<img <?php 
            echo createMascot($root_path, 'mascot1_r.gif', '0', 'bottom');
            ?>
 align="absmiddle">
<?php 
            if ($error > 1) {
                echo "<script language=\"Javascript\" type=\"text/javascript\"> </script>";
                //alert('$LDErrorS')
                echo $LDErrorS;
            } else {
                /* echo "<script language=\"Javascript\" type=\"text/javascript\"> alert('Information is missing in the input field marked red!') </script>"; */
                echo $LDError;
            }
            ?>
			</center>
			</td>
			</tr>
<?php 
        } elseif ($error_person_exists) {
            ?>
			<tr bgcolor=#ffffee>
			<td colspan=3>
			<center>
				<table border=0>
				<tr>
				<td><img <?php 
            echo createMascot($root_path, 'mascot1_r.gif', '0', 'bottom');
            ?>
 align="absmiddle"></td>
				<td><font face=arial color=#7700ff size=4>
<?php 
            echo $LDPersonDuplicate;
            if ($duperson->RecordCount() > 1) {
                echo " {$LDSimilarData2} {$LDPlsCheckFirst2}";
            } else {
                echo "{$LDSimilarData} {$LDPlsCheckFirst}";
            }
            echo "<script language=\"Javascript\" type=\"text/javascript\"> </script>";
            // alert('$LDSimilarData $LDPlsCheckFirst')
            echo '
				</td>
				</tr>
				</table>
			</center>
			</td>
			</tr>

			<tr>
			<td colspan=3>

				<table border=0 cellspacing=0 cellpadding=1 bgcolor="#000000" width=100%>
				<tr>
				<td>
					<table border=0 cellspacing=0 width=100% bgcolor="#ffffff">';
            echo '
		 			<tr bgcolor="#66ee66" background="' . $root_path . 'gui/img/common/default/tableHeaderbg.gif">';
            echo "\n\t\t\t\t\t<td {$tbg}><FONT  SIZE=-1  FACE=\"Arial\" color=\"#000066\"><b>\n\t\t\t\t\t\t{$LDRegistryNr}</b></td>\n\t\t\t\t\t<td {$tbg}><FONT  SIZE=-1  FACE=\"Arial\" color=\"#000066\"><b>\n\t\t\t\t\t\t{$LDLastName}</b></td>\n\t\t\t\t\t<td {$tbg}><FONT  SIZE=-1  FACE=\"Arial\" color=\"#000066\"><b>\n\t\t\t\t\t\t{$LDFirstName}</b></td>\n\t\t\t\t\t<td {$tbg}><FONT  SIZE=-1  FACE=\"Arial\" color=\"#000066\"><b>\n\t\t\t\t\t\t{$LDBday}</b></td>\n\t\t\t\t\t<td {$tbg}><FONT  SIZE=-1  FACE=\"Arial\" color=\"#000066\"><b>\n\t\t\t\t\t\t{$LDSex}</b></td>\n\t\t\t\t\t<td {$tbg}><FONT  SIZE=-1  FACE=\"Arial\" color=\"#000066\"><b>\n\t\t\t\t\t\t{$LDOptions}</b></td>\n\t\t\t\t\t</tr>";
            # Show the probable same person
            while ($dup = $duperson->FetchRow()) {
                echo '
					<tr>
					<td><font face=arial color=#000000 size=2>' . $dup['pid'] . '</td>
					<td><font face=arial color=#000000 size=2>' . $dup['name_last'] . '</td>
					<td><font face=arial color=#000000 size=2>' . $dup['name_first'] . '</td>
					<td><font face=arial color=#000000 size=2>' . formatDate2Local($dup['date_birth'], $date_format) . '</td>
					<td>';
                switch ($dup['sex']) {
                    case 'f':
                        echo '<img ' . $img_female . '>';
                        break;
                    case 'm':
                        echo '<img ' . $img_male . '>';
                        break;
                    default:
                        echo '&nbsp;';
                        break;
                }
                echo '
					</td>
					<td><font face=arial color=#000000 size=2>:: <a href="person_reg_showdetail.php' . URL_APPEND . '&pid=' . $dup['pid'] . '&from=$from&newdata=1&target=entry" target="_blank">' . $LDShowDetails . '</a> ::
					<a href="patient_register.php' . URL_APPEND . '&pid=' . $dup['pid'] . '&update=1">' . $LDUpdate . '</a>
					</td>
   					</tr>';
            }
            echo '
					</table>
				</td>
				</tr>
				</table>';
        }
        ?>
			</td>
			</tr>

			<tr>
			<td>
				<FONT SIZE=-1  FACE="Arial"><?php 
        if ($pid) {
            echo $LDRegistryNr;
        }
        ?>
			</td>
			<td >
				<FONT SIZE=-1  FACE="Arial" color="#800000">
				<?php 
        if ($pid) {
            if (IS_TANZANIAN) {
                echo $this->showPID($pid);
            } else {
                echo $pid;
            }
        }
        ?>
&nbsp;
			</td>
			<td  rowspan=6 class="photo_id" >
				<FONT SIZE=-1  FACE="Arial">
				<a href="#"  onClick="showpic(document.aufnahmeform.photo_filename)"><img <?php 
        echo $img_source;
        ?>
 id="headpic" name="headpic"></a>
				<br>
				<?php 
        echo $LDPhoto;
        ?>
				<br><input name="photo_filename" type="file" size="15"   onChange="showpic(this)" value="<?php 
        if (isset($photo_filename)) {
            echo $photo_filename;
        }
        ?>
">

			</td>
			</tr>

			<tr>
			<td class="reg_item">
				<?php 
        echo $LDRegDate;
        ?>
:
			</td>
			<td class="reg_input">
				<FONT SIZE=-1  FACE="Arial" color="#800000">
				<?php 
        echo formatDate2Local($date_reg, $date_format);
        ?>
				<input name="date_reg" type="hidden" value="<?php 
        echo $date_reg;
        ?>
">
			</td>
			</tr>

			<tr>
			<td class="reg_item">
				<?php 
        echo $LDRegTime;
        ?>
:
			</td>
			<td class="reg_input">
				<FONT SIZE=-1  FACE="Arial" color="#800000"><?php 
        echo convertTimeToLocal(formatDate2Local($date_reg, $date_format, 0, 1));
        ?>
			</td>
			</tr>
			<tr>
			<td class="reg_item">
				<FONT SIZE=-1  FACE="Arial"><?php 
        if ($person_obj->IsHospitalFileNrMandatory()) {
            $asterik = '*';
        } else {
            $asterik = ' ';
        }
        if ($errorfilenr) {
            echo '<font color="#ff0000">*' . $LDFileNr . '</font><br>
					Try this one: ' . $person_obj->GetNewSelianFileNumber();
        } else {
            echo $asterik . $LDFileNr;
        }
        ?>
			</td>
			<td class="reg_input">
				<input type="text" name="selian_pid" size=14 maxlength=6 value="<?php 
        echo $selian_pid;
        ?>
" onFocus="this.select();">
			</td>
			</tr>

<?php 
        $this->createTR($errornamefirst, 'name_first', ' *' . $LDFirstName, $name_first, '', '', FALSE);
        $this->createTR($errorname2, 'name_2', ' *' . $LDName2, $name_2, '', '', FALSE);
        $this->createTR($errornamelast, 'name_last', ' *' . $LDLastName, $name_last, '', '', FALSE);
        $this->createTR($errornamemid, 'name_middle', $LDNameMid, $name_middle, '', '', FALSE);
        // This is for balozi
        if (!$no_tribe) {
            ?>

			<tr>
				<td class="reg_item"><FONT SIZE=-1  FACE="Arial,verdana,sans serif">
				<?php 
            if ($errormaiden) {
                echo '<font color="FF0000">';
            }
            echo '* ' . $LDNameMaiden;
            ?>
</td>
				<td  class="reg_input" colspan=1>

				<?php 
            echo '<SELECT name="name_maiden" onChange="list_popup(this, \'tribe\');">';
            echo '<OPTION value="-1" >' . $LDPleaseSelectTribe . '</OPTION>';
            foreach ($tribe_array as $unit) {
                //if($update && (strtoupper($name_maiden) == strtoupper($unit[1])))
                if (strtoupper($name_maiden) == strtoupper($unit[1])) {
                    $check = 'selected';
                } else {
                    $check = '';
                }
                echo '<OPTION value="' . $unit[1] . '" ' . $check . '>' . $unit[0] . '</OPTION>';
            }
            // echo '<OPTION value="notinlist">NOT IN LIST</OPTION>';
            echo '</SELECT>';
            ?>

				</td>
			</tr>

<?php 
        }
        ?>

			<tr>
			<td class="reg_item">
				<FONT SIZE=-1  FACE="Arial"><?php 
        if ($errordatebirth) {
            echo "<font color=red>";
        }
        ?>
* <?php 
        echo $LDBday;
        ?>
</font>:
			</td>
			<td class="reg_input">
				<FONT SIZE=-1  FACE="Arial">
				<input name="date_birth" type="text" size="15" maxlength=10 value="<?php 
        if ($date_birth) {
            if ($mode == 'save' || $error || $error_person_exists) {
                echo $date_birth;
            } else {
                echo formatDate2Local($date_birth, $date_format);
            }
        }
        # Uncomment the following when the current date must be inserted
        # automatically at the start of each document
        /*else{
        			echo formatDate2Local(date('Y-m-d'),$date_format);
        		}*/
        ?>
"
 				onFocus="this.select();"
				onBlur="IsValidDate(this,'<?php 
        echo $date_format;
        ?>
')"
				onKeyUp="setDate(this,'<?php 
        echo $date_format;
        ?>
','<?php 
        echo $lang;
        ?>
');">
				<a href="javascript:show_calendar('aufnahmeform.date_birth','<?php 
        echo $date_format;
        ?>
')">
				<img <?php 
        echo createComIcon($root_path, 'show-calendar.gif', '0', 'absmiddle');
        ?>
></a>


				<font size=1>[
<?php 
        $dfbuffer = "LD_" . strtr($date_format, ".-/", "phs");
        echo ${$dfbuffer};
        ?>
				 ] </font><br>
<input name="date_age" type="text" size="15" maxlength=10 value="" onKeyUp="setDatebyAge(this,this.form.date_birth,'<?php 
        echo $date_format;
        ?>
','<?php 
        echo $lang;
        ?>
')">
				<font size=1>
<?php 
        echo $LDAge;
        ?>
</font>
			</td>
			<td>&nbsp;</td>
			<tr>
			<td class="reg_item">
			<FONT SIZE=-1  FACE="Arial">
<?php 
        if ($errorsex) {
            echo "<font color=#ff0000>";
        }
        echo '* ' . $LDSex . '</font>';
        ?>
:<td>
			<input name="sex" type="radio" value="m"  <?php 
        if ($sex == "m") {
            echo "checked";
        }
        ?>
><?php 
        echo $LDMale;
        ?>
&nbsp;&nbsp;
			<input name="sex" type="radio" value="f"  <?php 
        if ($sex == "f") {
            echo "checked";
        }
        ?>
>

<?php 
        echo $LDFemale;
        if ($errorsex) {
            echo "</font>";
        }
        # But patch 2004-03-10
        # Clean blood group
        $blood_group = trim($blood_group);
        ?>
			</td>
			</tr>
			<tr>
			<td class="reg_item">
				<FONT SIZE=-1  FACE="Arial"><?php 
        if ($errorreligion) {
            echo "<font color=red>";
        }
        ?>
* <?php 
        echo $LDReligion;
        ?>
:
			</td>
			<td class="reg_input">
<?php 
        echo '<SELECT name="religion" onChange="list_popup(this,\'religion\');">';
        echo '<OPTION value="-1" >' . $LDSelectReligion . '</OPTION>';
        foreach ($religion_array as $unit) {
            if (strtoupper($religion) == strtoupper($unit[1])) {
                $check = 'selected';
            } else {
                $check = '';
            }
            echo '<OPTION value="' . $unit[1] . '" ' . $check . '>' . $unit[0] . '</OPTION>';
        }
        // echo '<OPTION value="notinlist">NOT IN LIST</OPTION>';
        echo '</SELECT>';
        ?>

			</td>
			</tr>
		<?php 
        if (!$person_name_others_hide) {
            $this->createTR($errornameothers, 'name_others', $LDNameOthers, $name_others);
        }
        ?>

<!--
TODO: Kompletly not shown, or dependig on who is editing: Doctor, Lab?
-->
 			<tr>
			<td class="reg_item">
				<?php 
        echo $LDBloodGroup;
        ?>
:
			</td>
			<td class="reg_input">
				<FONT SIZE=-1  FACE="Arial">
				<input name="blood_group" type="radio" value="A"  <?php 
        if ($blood_group == 'A') {
            echo 'checked';
        }
        ?>
><?php 
        echo $LDA;
        ?>
&nbsp;&nbsp;
				<input name="blood_group" type="radio" value="B"  <?php 
        if ($blood_group == 'B') {
            echo 'checked';
        }
        ?>
><?php 
        echo $LDB;
        ?>
&nbsp;&nbsp;
				<input name="blood_group" type="radio" value="AB"  <?php 
        if ($blood_group == 'AB') {
            echo 'checked';
        }
        ?>
><?php 
        echo $LDAB;
        ?>
&nbsp;&nbsp;
				<input name="blood_group" type="radio" value="O"  <?php 
        if ($blood_group == 'O') {
            echo 'checked';
        }
        ?>
><?php 
        echo $LDO;
        ?>
			</td>
			<td>
							<?php 
        echo $LDRHfactor;
        ?>
<input name="rh" type="radio" value="pos"
			<?php 
        if ($rh == 'pos') {
            echo 'checked';
        }
        ?>
><?php 
        echo $LDRHpos;
        ?>
				<input name="rh" type="radio" value="neg"
			<?php 
        if ($rh == 'neg') {
            echo 'checked';
        }
        ?>
><?php 
        echo $LDRHneg;
        ?>
			</td>
			</tr>
			<tr>
			<td class="reg_item">
				<FONT SIZE=-1  FACE="Arial"><?php 
        if ($errorcivil) {
            echo "<font color=red>";
        }
        ?>
 <?php 
        echo $LDCivilStatus;
        ?>
</font>:
			</td>
			<td colspan=2 class="reg_input">
				<FONT SIZE=-1  FACE="Arial"> <input name="civil_status" type="radio" value="single"  <?php 
        if ($civil_status == "single") {
            echo "checked";
        }
        ?>
><?php 
        echo $LDSingle;
        ?>
&nbsp;&nbsp;
				<input name="civil_status" type="radio" value="married"  <?php 
        if ($civil_status == "married") {
            echo "checked";
        }
        ?>
><?php 
        echo $LDMarried;
        ?>
				<FONT SIZE=-1  FACE="Arial"> <input name="civil_status" type="radio" value="divorced"  <?php 
        if ($civil_status == "divorced") {
            echo "checked";
        }
        ?>
><?php 
        echo $LDDivorced;
        ?>
&nbsp;&nbsp;
				<input name="civil_status" type="radio" value="widowed"  <?php 
        if ($civil_status == "widowed") {
            echo "checked";
        }
        ?>
><?php 
        echo $LDWidowed;
        ?>
				<FONT SIZE=-1  FACE="Arial"> <input name="civil_status" type="radio" value="separated"  <?php 
        if ($civil_status == "separated") {
            echo "checked";
        }
        ?>
><?php 
        echo $LDSeparated;
        ?>
&nbsp;&nbsp;
			</td>
			</tr>
			<tr>
				<td class="reg_item">
				<FONT SIZE=-1  FACE="Arial"> <?php 
        echo $LDInsurance;
        ?>
:
			</td>
				<td class="reg_input"> <?php 
        // Create array of all insurances for GUI
        $coreObj->sql = "SELECT DISTINCT parent FROM care_tz_insurance WHERE cancel_flag='0' order by name asc";
        $result = $db->Execute($coreObj->sql);
        $name_insurer_array = array();
        while ($row = $result->FetchRow()) {
            $nr = $row['insurance_ID'];
            if ($nr != -1) {
                $coreObj->sql = "SELECT name FROM care_tz_company WHERE insurance_ID={$nr}";
                $ergebnis = $db->Execute($coreObj->sql);
                $row = $ergebnis->FetchRow();
                $arrayTemp = array("name" => $row['name'], "id" => $nr);
                array_push($name_insurer_array, $arrayTemp);
            }
        }
        echo '<SELECT name="insurance_ID">';
        echo '<OPTION value="-1" >--select insurance--</OPTION>';
        foreach ($name_insurer_array as $row) {
            if ($insurance_ID == $row[id]) {
                $check = 'selected';
            } else {
                $check = '';
            }
            echo '<OPTION value="' . $row[id] . '" ' . $check . '>' . $row[name] . '</OPTION>';
        }
        echo '</SELECT>';
        ?>
</td>

			</tr>
			<tr>
			<td class="reg_item">
				<FONT SIZE=-1  FACE="Arial"><?php 
        echo $LDOccupation;
        ?>
:
			</td>
			<td class="reg_input">
				<input type="text" name="title" size=14 maxlength=25 value="<?php 
        echo $title;
        ?>
" onFocus="this.select();">
			</td>
			</tr>
			<tr>
			<td class="reg_item">
				<FONT SIZE=-1  FACE="Arial"><?php 
        echo $LDEducation;
        ?>
:
			</td>
			<td class="reg_input">
				<input type="text" name="name_others" size=14 maxlength=25 value="<?php 
        echo $name_others;
        ?>
" onFocus="this.select();">
			</td>
			</tr>

<!-- 		<tr>
			<td colspan=2>
				<FONT SIZE=-1  FACE="Arial"><?php 
        if ($erroraddress) {
            echo "<font color=red>";
        }
        echo $LDAddress;
        ?>
</font>:
			</td>
			</tr>
-->

<?php 
        if (!$person_email_hide) {
            //{
            ?>
			<tr>
				<td class="reg_item"><FONT SIZE=-1  FACE="Arial,verdana,sans serif">
				<?php 
            if ($errormaiden) {
                echo '<font color="FF0000">';
            }
            echo '* ' . 'Region';
            $sql = "SELECT DISTINCT region_id, region_name FROM care_tz_region region INNER JOIN care_tz_district distrcit ON distrcit.is_additional=region.region_id INNER JOIN care_tz_ward ward ON distrcit.district_id=ward.is_additional ORDER BY region_name, district_name, ward_name";
            //$sql="SELECT region_id,region_name FROM view_care_region_district_ward GROUP BY region_id order by region_name ";
            $catchment_area_obj = $db->Execute($sql);
            ?>
</td>
				<td  class="reg_input" colspan=1>
					<select name="region" size="1" onChange="redirect(this.options.selectedIndex)">

						<option value="-1" id="-1">---select region--------</option>
						<?php 
            while ($catchment_area_row = $catchment_area_obj->FetchRow()) {
                echo '<option value="' . $catchment_area_row['region_name'] . '" id=' . $catchment_area_row['region_id'] . '>' . $catchment_area_row['region_name'] . '</option>';
            }
            ?>
					</select>

				<?php 
        }
        ?>

				</td>
				<?php 
        if ($update) {
            ?>
					<td class="reg_input"><FONT SIZE=-1  FACE="Arial,verdana,sans serif">
					<?php 
            if ($errormaiden) {
                echo '<font color="FF0000">';
            }
            $sql = "Select * from care_person where pid=" . $pid;
            $result = $db->Execute($sql);
            $region = $result->FetchRow();
            echo '' . 'Region:<FONT SIZE=-1 FACE="Arial" color="#800000"> ' . $region['region'] . '</FONT>';
            ?>
</td><?php 
        }
        ?>
			</tr>
			<tr></tr>
			<tr>
				<td class="reg_item"><FONT SIZE=-1  FACE="Arial,verdana,sans serif">
				<?php 
        if ($errormaiden) {
            echo '<font color="FF0000">';
        }
        echo '* ' . 'District';
        ?>
</td>
				<td  class="reg_input" colspan=1>

							<select name="district" size="1" onChange="redirect1(this.options.selectedIndex)">
							<option value="-1" >---select district--------</option>
							</select>


				</td>
				<?php 
        if ($update) {
            ?>
					<td class="reg_input"><FONT SIZE=-1  FACE="Arial,verdana,sans serif">
					<?php 
            if ($errormaiden) {
                echo '<font color="FF0000">';
            }
            $sql = "Select * from care_person where pid=" . $pid;
            $result = $db->Execute($sql);
            $region = $result->FetchRow();
            echo '' . 'District: <FONT SIZE=-1 FACE="Arial" color="#800000">' . $region['district'] . '</FONT>';
            ?>
</td><?php 
        }
        ?>
			</tr>
			<tr></tr>
			<tr>
				<td class="reg_item"><FONT SIZE=-1  FACE="Arial,verdana,sans serif">
				<?php 
        if ($errormaiden) {
            echo '<font color="FF0000">';
        }
        echo '* ' . 'Ward';
        ?>
</td>
				<td  class="reg_input" colspan=1>
					<select name="ward" size="1">
						<option value="-1" >-select Ward-</option>
					</select>

			<?php 
        ?>

			<script language="javascript">

				<?php 
        // fill up all regions, districts and wards:
        $sql = "SELECT region_id, region_name, district_id, district_name, ward_id, ward_name FROM care_tz_region region INNER JOIN care_tz_district distrcit ON distrcit.is_additional=region.region_id INNER JOIN care_tz_ward ward ON distrcit.district_id=ward.is_additional ORDER BY region_name, district_name, ward_name";
        $catchment_area_obj = $db->Execute($sql);
        $number_of_rows = $catchment_area_obj->RecordCount();
        echo "var group=new Array(" . $number_of_rows . ")\n";
        echo "for (i=0; i<" . $number_of_rows . "; i++)\n";
        echo "group[i]=new Array()\n";
        echo "group[0]= new Option(\"---select Region -----\");\n";
        echo "group[0][0]=new Option(\"---select district--------\");\n";
        echo "group[1][0]=new Option(\"now select this one\");\n";
        echo "group[1][0][0]=new Option(\"-select Ward-\");\n";
        // define some variables that eclipse will get no trouble by syntax error check...
        $previous_region_id = -1;
        $previous_district_id = -1;
        $region_id = 1;
        $district_id = 0;
        $ward_id = 0;
        // remember if it's the first row...
        $FIRST_ROW = TRUE;
        while ($catchment_area_row = $catchment_area_obj->FetchRow()) {
            // reading out all information of this row and store each to a variable
            $this_region_name = $catchment_area_row['region_name'];
            $this_district_name = $catchment_area_row['district_name'];
            $this_district_id = $catchment_area_row['district_id'];
            $this_ward_name = $catchment_area_row['ward_name'];
            $this_ward_id = $catchment_area_row['ward_id'];
            if ($FIRST_ROW == TRUE) {
                // it's the first row, the "this" is the same as the "previous" status
                $previous_region_id = $region_id;
                $previous_ward_id = $ward_id;
                $previous_district_id = $district_id;
                // if its the first row, so we can attach this line directly to the jscript-array:
                echo "group[" . $region_id . "][" . $district_id . "]=new Option(\"" . $this_district_name . "\");\n";
                // "this" is no longer the first row, set it to FALSE
                $FIRST_ROW = FALSE;
            } else {
                // reading out all information of this row and store each to a variable
                $this_region_id = $catchment_area_row['region_id'];
                $this_region_name = $catchment_area_row['region_name'];
                $this_district_name = $catchment_area_row['district_name'];
                $this_district_id = $catchment_area_row['district_id'];
                // it is not the first row, so we have to be a bit more carefully
                if ($this_region_id == $previous_region_id) {
                    // if its the same region ID like the previous one, so check if it's a new district as well:
                    if ($this_district_id == $previous_district_id) {
                        // if its the same district ID like the previous one, then we have a new ward
                        echo "group[" . $region_id . "][" . $district_id . "][" . $ward_id . "]=new Option(\"" . $this_ward_name . "\"); // Ward_id=" . $this_ward_id . "\n";
                        $ward_id = $ward_id + 1;
                    } else {
                        $district_id = $district_id + 1;
                        $previous_district_id = $this_district_id;
                        $ward_id = 0;
                        echo "group[" . $region_id . "][" . $district_id . "]=new Option(\"" . $this_district_name . "\"); //Region_id=" . $this_region_id . "\n";
                    }
                } else {
                    // it's a new region, so reset the value of "this region"
                    $district_id = 0;
                    $region_id = $region_id + 1;
                    echo "group[" . $region_id . "][" . $district_id . "]=new Option(\"" . $this_district_name . "\"); //Region_id=" . $this_region_id . "\n";
                    $previous_region_id = $this_region_id;
                }
                // end of if ($this_region_id==$previous_region_id)
            }
            // end of if ($FIRST_ROW==TRUE)
        }
        ?>


				var temp_district=document.aufnahmeform.district
				var temp_ward=document.aufnahmeform.ward

				function redirect(x){

					// delete all previous entries
					for (m=temp_district.options.length-1;m>0;m--)
						temp_district.options[m]=null;
					// set the new ones to this option list

					for (i=1;i<group[x].length;i++){
						temp_district.options[i]=new Option(group[x][i].text)
					}
					temp_district.options[0].selected=true;
					temp_district.options[0].value=-1;
					redirect1(0)
					}



				function redirect1(y){
					for (m=temp_ward.options.length-1;m>=0;m--)
						temp_ward.options[m]=null;

					var region_index = document.aufnahmeform.region.options.selectedIndex;
					var district_index = document.aufnahmeform.district.options.selectedIndex;
					var i = 0;

					for (i=0;i<100;i++){
						temp_ward.options[i]=new Option(group[region_index][district_index][i].text)
					}

					temp_ward.options[0].selected=true
					temp_ward.options[0].value=-1;

				}

			</script>


				</td>
				<?php 
        if ($update) {
            ?>
					<td class="reg_input"><FONT SIZE=-1  FACE="Arial,verdana,sans serif">
					<?php 
            if ($errormaiden) {
                echo '<font color="FF0000">';
            }
            $sql = "Select * from care_person where pid=" . $pid;
            $result = $db->Execute($sql);
            $region = $result->FetchRow();
            echo '' . 'Ward: <FONT SIZE=-1 FACE="Arial" color="#800000">' . $region['ward'] . '</FONT>';
            ?>
</td><?php 
        }
        ?>

			<tr>
			<td colspan=2>
				<FONT SIZE=-1  FACE="Arial"><?php 
        if ($erroraddress) {
            echo "<font color=red>";
        }
        echo $LDAddress;
        ?>
</font>:
			</td>
			</tr>

			<tr>
			<td class="reg_item">
				<FONT SIZE=-1  FACE="Arial"><?php 
        echo $LDTownCity;
        ?>
:
			</td>
			<td class="reg_input"><input name="citizenship" type="text" value="<?php 
        echo $citizenship;
        ?>
" ></td>
			<!--<td class="reg_input">
<?php 
        echo '<SELECT name="addr_citytown_nr" onChange="list_popup(this,\'city\');">';
        echo '<OPTION value="-1" >-- select location --</OPTION>';
        foreach ($town_array as $unit) {
            if (strtoupper($addr_citytown_nr) == strtoupper($unit[1])) {
                $check = 'selected';
            } else {
                $check = '';
            }
            echo '<OPTION value="' . $unit[1] . '" ' . $check . '>' . $unit[0] . '</OPTION>';
        }
        // echo '<OPTION value="notinlist">NOT IN LIST</OPTION>';
        echo '</SELECT>';
        ?>

			</td>-->
			<td class="reg_input">
				&nbsp;&nbsp;<FONT SIZE=-1  FACE="Arial"><?php 
        if ($errorzip) {
            echo "<font color=red>";
        }
        echo $LDPOBOX . " ";
        ?>
<input name="addr_zip" type="text" size="10" value="<?php 
        echo $addr_zip;
        ?>
" >
			</td>
			</tr>

<?php 
        if ($insurance_show) {
            if (!$person_insurance_1_nr_hide) {
                ?>
			<!--<tr>
			<td class="reg_item">
				<FONT SIZE=-1  FACE="Arial"><?php 
                if ($errorinsurancecoid) {
                    echo '<font color="' . $error_fontcolor . '">';
                }
                echo $LDInsuranceCo;
                ?>
:
			</td>
			<td colspan=2 class="reg_input"><FONT SIZE=-1  FACE="Arial"><?php 
                if ($errorinsuranceclass) {
                    echo '<font color="' . $error_fontcolor . '">';
                }
                ?>

					<input name="insurance_category" type="radio"  value="silver"  <?php 
                if ($insurance_category == "silver") {
                    echo 'checked';
                }
                ?>
> <?php 
                echo $LDInsuranceSilver;
                ?>
					<input name="insurance_category" type="radio"  value="gold"  <?php 
                if ($insurance_category == "gold") {
                    echo 'checked';
                }
                ?>
> <?php 
                echo $LDInsuranceGold;
                ?>
					<input name="insurance_category" type="radio"  value="friedkin"  <?php 
                if ($insurance_category == "friedkin") {
                    echo 'checked';
                }
                ?>
> <?php 
                echo $LDInsuranceFriedkin;
                ?>
					<input name="insurance_category" type="radio"  value="selian"  <?php 
                if ($insurance_category == "selian") {
                    echo 'checked';
                }
                ?>
> <?php 
                echo $LDInsuranceSelianstuff;
                ?>

			</td>
			</tr>-->
<?php 
            }
        } else {
            ?>
			<tr>
			<td colspan=2 class="reg_item">
				<a><?php 
            echo $LDSeveralInsurances;
            ?>
<img <?php 
            echo createComIcon($root_path, 'frage.gif', '0');
            ?>
></a>
			</td>
			</tr>
<?php 
        }
        if (!$person_phone_1_nr_hide) {
            $this->createTR($errorphone1, 'phone_1_nr', $LDPhone, $phone_1_nr, 2);
        }
        if (!$person_cellphone_1_nr_hide) {
            $this->createTR($errorcell1, 'cellphone_1_nr', $LDCellPhone, $cellphone_1_nr, 2);
        }
        if (!$person_cellphone_2_nr_hide) {
            $this->createTR($errorcell2, 'cellphone_2_nr', $LDCellPhone . ' 2', $cellphone_2_nr, 2);
        }
        if (!$person_religion_hide) {
            ?>


			<?php 
        }
        ?>
				<!--<tr>
				<td class="reg_item" valign=top class="reg_input">
					<?php 
        echo $LDOtherHospitalNr;
        ?>
				</td>
				<td colspan=2 class="reg_input">
				<?php 
        /*
        $other_hosp_list = $person_obj->OtherHospNrList();
        $sOtherNrBuffer='';
        foreach( $other_hosp_list as $k=>$v ){
        	echo "<b>".$kb_other_his_array[$k].":</b> ".$v."<br />\n";
        }
        
        
        echo '<SELECT name="other_his_org">
        	<OPTION value="">--</OPTION>';
        foreach( $kb_other_his_array as $k=>$v ){
        	echo '<OPTION value="$k" $check>$v</OPTION>';
        }
         echo '</SELECT>&nbsp;&nbsp;'.$LDNr.':<INPUT name="other_his_no" size=20><br>';
        
        echo '('.$LDSelectOtherHospital.' - '.$LDNoNrNoDelete.')<br></TD></TR>';
        */
        ?>
				</td>
				</tr>-->
			<tr>
			<td class="reg_item">
				<FONT SIZE=-1  FACE="Arial" ><FONT  SIZE=2  FACE="Arial"><font color=#ff0000><?php 
        echo $LDRegBy;
        ?>
</font>
			</td>
			<td colspan=2 class="reg_input">
				<FONT SIZE=-1  FACE="Arial"><nobr>
				<input  name="user_id" type="text" value="<?php 
        if (isset($user_id) && $user_id) {
            echo $user_id;
        } else {
            echo $_SESSION['sess_user_name'];
        }
        ?>
"  size="35" readonly>
				</nobr>
			</td>
			</tr>

			</table>
			<p>
			<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000000">
			<input type="hidden" name="itemname" value="<?php 
        echo $itemname;
        ?>
">
			<input type="hidden" name="sid" value="<?php 
        echo $sid;
        ?>
">
			<input type="hidden" name="lang" value="<?php 
        echo $lang;
        ?>
">
			<input type="hidden" name="linecount" value="<?php 
        echo $linecount;
        ?>
">
			<input type="hidden" name="mode" value="save">

			<input type="hidden" name="insurance_item_nr" value="<?php 
        echo $insurance_item_nr;
        ?>
">
			<input type="hidden" name="insurance_firm_id" value="<?php 
        echo $insurance_firm_id;
        ?>
">
			<input type="hidden" name="insurance_show" value="<?php 
        echo $insurance_show;
        ?>
">
			<input type="hidden" name="ethnic_orig" value="<?php 
        echo $ethnic_orig;
        ?>
">
<?php 
        if ($update) {
            echo '<input type="hidden" name="update" value=1>';
            echo '<input type="hidden" name="pid" value="' . $pid . '">';
        }
        ?>
			<input  type="image" <?php 
        echo createLDImgSrc($root_path, 'savedisc.gif', '0');
        ?>
  alt="<?php 
        echo $LDSaveData;
        ?>
" align="absmiddle">
				<a href="javascript:document.aufnahmeform.reset()"><img <?php 
        echo createLDImgSrc($root_path, 'reset.gif', '0');
        ?>
 alt="<?php 
        echo $LDResetData;
        ?>
"   align="absmiddle"></a>
<?php 
        //if($error||$error_person_exists) echo '<input  type="button" value="'.$LDForceSave.'" onClick="forceSave()">';
        ?>
		</form>


<?php 
        if (!$newdata) {
            ?>
			<form action=<?php 
            echo $thisfile;
            ?>
 method=post>
				<input type=hidden name=sid value=<?php 
            echo $sid;
            ?>
>
				<input type=hidden name=patnum value="">
				<input type=hidden name="lang" value="<?php 
            echo $lang;
            ?>
">
				<input type=hidden name="date_format" value="<?php 
            echo $date_format;
            ?>
">
				<input type=submit value="<?php 
            echo $LDNewForm;
            ?>
" >
			</form>
<?php 
        }
    }
Example #14
0
 * @version     CVS: $Id: maple.inc.php,v 1.2 2006/10/13 09:38:47 Ryuji.M Exp $
 */
//
//基本となるディレクトリの設定
//
if (!defined('BASE_DIR')) {
    define('BASE_DIR', dirname(dirname(dirname(__FILE__))));
}
define('WEBAPP_DIR', dirname(dirname(__FILE__)));
define('MAPLE_DIR', 'maple');
//
//基本となる定数の読み込み
//
require_once BASE_DIR . "/" . MAPLE_DIR . '/config/common.php';
require_once BASE_DIR . "/" . MAPLE_DIR . '/core/GlobalConfig.class.php';
GlobalConfig::loadConstantsFromFile(dirname(__FILE__) . '/' . GLOBAL_CONFIG);
//
// Smarty関連のディレクトリ設定
// (注意)ディレクトリ指定での最後に「/」をつけること
//
define('SMARTY_DIR', MAPLE_DIR . '/smarty/');
define('SMARTY_COMPILE_DIR', WEBAPP_DIR . '/templates_c/');
define('SMARTY_DEFAULT_MODIFIERS', 'escape:"html"');
//configテーブルにデータがない場合に使用されるデフォルト値
define('SMARTY_CACHING', 2);
define('SMARTY_CACHE_LIFETIME', 3600);
//1時間キャッシュを保持
define('SMARTY_COMPILE_CHECK', false);
define('SMARTY_FORCE_COMPILE', false);
//define('SMARTY_DEBUGGING',     false);
//
Example #15
0
    $_SESSION['sess_full_pnr'];
}
$patregtable = 'care_person';
// The table of the patient registration data
//$dbtable='care_encounter'; // The table of admission data
/* Create new person's insurance object */
$pinsure_obj = new PersonInsurance($pid);
/* Get the insurance classes */
$insurance_classes =& $pinsure_obj->getInsuranceClassInfoObject('class_nr,name,LD_var');
/* Create new person object */
$person_obj = new Person($pid);
/* Create personell object */
$personell_obj = new Personell();
if ($pid || $personell_nr) {
    # Get the patient global configs
    $glob_obj = new GlobalConfig($GLOBAL_CONFIG);
    $glob_obj->getConfig('personell_%');
    $glob_obj->getConfig('person_foto_path');
    # Check whether config path exists, else use default path
    $photo_path = is_dir($root_path . $GLOBAL_CONFIG['person_foto_path']) ? $GLOBAL_CONFIG['person_foto_path'] : $default_photo_path;
    if ($pid) {
        # Check whether the person is currently admitted. If yes jump to display admission data
        if ($mode != 'save' && ($personell_nr = $personell_obj->Exists($pid))) {
            header('Location:personell_register_show.php' . URL_REDIRECT_APPEND . '&personell_nr=' . $personell_nr . '&origin=admit&sem=isadmitted&target=personell_reg');
            exit;
        }
        # Get the related insurance data
        $p_insurance =& $pinsure_obj->getPersonInsuranceObject($pid);
        if ($p_insurance == FALSE) {
            $insurance_show = TRUE;
        } else {
Example #16
0
<?php

include '../inc/php.php';
//$autologin = null;
//$enable_autologin = false;
$autologin = Lib::isDefined('autologin');
$enable_autologin = Lib::isDefined('autologin');
$num_log = Lib::isDefined('num_log');
$globalConfig = new GlobalConfig();
//if ($conf->exec_debug) {
//    echo '<h3>Mode Debugger</h3>';
//}
//Autologin
if (!$autologin and $enable_autologin == 1) {
    $autologin = $_GET['autologin'];
    $enable_autologin = $_GET['enable_autologin'];
    echo '
Pour accéder à l\'intranet en mode <b>Authentification automatique</b>, veuillez configurer votre navigateur Internet Explorer de la manière suivante:<br>
<br>
1. Aller dans Outils > Options Internet > Sécurité:<br>
2. Sélectionner \'Sites de confiance\'<br>
3. Cliquez sur le bouton \'Sites\'<br>
4. Ajouter *.agis.fr<br>
5. Décochez \'Exiger un serveur sécurisé (https) pour tous les sites de cette zone\'<br>
6. Validez en cliquant sur le bouton \'Fermer\'<br>
7. Cliquez sur \'personnaliser le niveau\'<br>
8. Aller dans \'Contrôles ActiveX et plug-ins\'<br>
9. Activer \'Contrôles d\'initialisation et de scripts ActiveX non marqué comme sécurisés pour l\'écriture de script\'<br>
10. Fermer et réouvrir le navigateur.<br>
<br>
<br>
Example #17
0
 * file should be added instead and then copied for each install
 */
require_once 'verysimple/Phreeze/ConnectionSetting.php';
require_once "verysimple/HTTP/RequestUtil.php";
/** database connection settings */
GlobalConfig::$CONNECTION_SETTING = new ConnectionSetting();
GlobalConfig::$CONNECTION_SETTING->ConnectionString = "localhost:3306";
GlobalConfig::$CONNECTION_SETTING->DBName = "napoli";
GlobalConfig::$CONNECTION_SETTING->Username = "******";
GlobalConfig::$CONNECTION_SETTING->Password = "******";
GlobalConfig::$CONNECTION_SETTING->Type = "MySQL";
GlobalConfig::$CONNECTION_SETTING->Charset = "utf8";
GlobalConfig::$CONNECTION_SETTING->Multibyte = true;
// GlobalConfig::$CONNECTION_SETTING->BootstrapSQL = "SET SQL_BIG_SELECTS=1";
/** the root url of the application with trailing slash, for example http://localhost/administrador de productos/ */
GlobalConfig::$ROOT_URL = RequestUtil::GetServerRootUrl() . 'napoli_admin/';
/** timezone */
// date_default_timezone_set("UTC");
/** functions for php 5.2 compatibility */
if (!function_exists('lcfirst')) {
    function lcfirst($string)
    {
        return substr_replace($string, strtolower(substr($string, 0, 1)), 0, 1);
    }
}
// if Multibyte support is specified then we need to check if multibyte functions are available
// if you receive this error then either install multibyte extensions or set Multibyte to false
if (GlobalConfig::$CONNECTION_SETTING->Multibyte && !function_exists('mb_strlen')) {
    die('<html>Multibyte extensions are not installed but Multibyte is set to true in _machine_config.php</html>');
}
/** level 2 cache */
Example #18
0
# Initialize page�s control variables
if ($mode != 'paginate') {
    # Reset paginator variables
    $pgx = 0;
    $totalcount = 0;
    # Set the sort parameters
    if (empty($oitem)) {
        $oitem = 'name';
    }
    if (empty($odir)) {
        $odir = 'ASC';
    }
}
$GLOBAL_CONFIG = array();
include_once $root_path . 'include/care_api_classes/class_globalconfig.php';
$glob_obj = new GlobalConfig($GLOBAL_CONFIG);
$glob_obj->getConfig('pagin_address_list_max_block_rows');
if (empty($GLOBAL_CONFIG['pagin_address_list_max_block_rows'])) {
    $GLOBAL_CONFIG['pagin_address_list_max_block_rows'] = MAX_BLOCK_ROWS;
}
# Last resort, use the default defined at the start of this page
#Load and create paginator object
require_once $root_path . 'include/care_api_classes/class_paginator.php';
$pagen = new Paginator($pgx, $thisfile, $_SESSION['sess_searchkey'], $root_path);
# Adjust the max nr of rows in a block
$pagen->setMaxCount($GLOBAL_CONFIG['pagin_address_list_max_block_rows']);
# Get all the active firms info
//$address=$address_obj->getAllActiveCityTown();
$address =& $address_obj->getLimitActiveCityTown($GLOBAL_CONFIG['pagin_address_list_max_block_rows'], $pgx, $oitem, $odir);
# Get the resulting record count
//echo $address_obj->getLastQuery();
Example #19
0
 $_SESSION[UserModel::FIELDNAME_PRENOM] = $prenom;
 $_SESSION[UserModel::KEYNAME] = $id_user;
 $_SESSION[UserModel::FIELDNAME_ID_CATSOPRO] = $id_catsopro;
 $_SESSION[UserModel::FIELDNAME_ID_SERVICE] = $id_service;
 $_SESSION[UserModel::FIELDNAME_ID_TYPE] = $nom_type;
 $_SESSION['num_log'] = $num_log;
 $_SESSION['position'] = $position;
 //$_SESSION['bdd']=$bdd;
 $_SESSION["mail_user"] = $mail_user;
 $_SESSION[UserModel::FIELDNAME_LIEU_GEO] = $lieu_geo;
 $_SESSION[UserModel::FIELDNAME_PORTAIL_WIKI_SALARIES] = $portail_wiki_salaries;
 /**
  * Enregistrement de l'utilisateur authentifié
  */
 $authenticatedUser = new UserModel($id_user);
 $globalConfig = new GlobalConfig();
 $globalConfig->setAuthenticatedUser($authenticatedUser);
 GlobalConfig::saveGlobalConfToPhpSession($globalConfig);
 /* --------------------------------------------------------------
    Appel de la page qui définit les droits d'accès de l'utilisateur
    dans l'ensemble des pages des modules
    -------------------------------------------------------------- */
 include 'droits_acces.php';
 /* -------------------------------------------------------------
    Variables définissant que l'utilisateur est sur l'Intranet Agis
    cette variable est utile lorsque l'utilisateur utilie des
    applications autres
    ------------------------------------------------------------- */
 //Permet à phpMyAdmin d'identifier l'Intranet
 $application_courante = 'intranet.agis.fr';
 //session_register( 'application_courante' );
Example #20
0
 * file should be added instead and then copied for each install
 */
require_once 'verysimple/Phreeze/ConnectionSetting.php';
require_once "verysimple/HTTP/RequestUtil.php";
/** database connection settings */
GlobalConfig::$CONNECTION_SETTING = new ConnectionSetting();
GlobalConfig::$CONNECTION_SETTING->ConnectionString = ":3306";
GlobalConfig::$CONNECTION_SETTING->DBName = "test";
GlobalConfig::$CONNECTION_SETTING->Username = "******";
GlobalConfig::$CONNECTION_SETTING->Password = "";
GlobalConfig::$CONNECTION_SETTING->Type = "MySQL_PDO";
GlobalConfig::$CONNECTION_SETTING->Charset = "utf8";
GlobalConfig::$CONNECTION_SETTING->Multibyte = true;
// GlobalConfig::$CONNECTION_SETTING->BootstrapSQL = "SET SQL_BIG_SELECTS=1";
/** the root url of the application with trailing slash, for example http://localhost/pizzaria meveana/ */
GlobalConfig::$ROOT_URL = RequestUtil::GetServerRootUrl() . 'meveana/';
/** timezone */
// date_default_timezone_set("UTC");
/** functions for php 5.2 compatibility */
if (!function_exists('lcfirst')) {
    function lcfirst($string)
    {
        return substr_replace($string, strtolower(substr($string, 0, 1)), 0, 1);
    }
}
// if Multibyte support is specified then we need to check if multibyte functions are available
// if you receive this error then either install multibyte extensions or set Multibyte to false
if (GlobalConfig::$CONNECTION_SETTING->Multibyte && !function_exists('mb_strlen')) {
    die('<html>Multibyte extensions are not installed but Multibyte is set to true in _machine_config.php</html>');
}
/** level 2 cache */
         $sql2 = $selectfrom . "\tWHERE o.encounter_nr=e.encounter_nr\n\t\t\t\t\t\t\t\t\t\t\tAND e.pid=p.pid \n\t\t\t\t\t\t\t\t\t\t\tAND (p.name_last = '{$srcword}'\n\t\t\t\t\t\t\t\t\t\t\tOR p.name_first = '{$srcword}'";
         if ($DOB) {
             $sql2 .= " OR p.date_birth = '{$srcword}' ";
         }
         if (is_numeric($srcword)) {
             $sql2 .= " OR o.op_nr = {$srcword} OR e.encounter_nr = {$srcword}";
         }
         $sql2 .= ")";
     }
 }
 #Load and create paginator object
 include_once $root_path . 'include/care_api_classes/class_paginator.php';
 $pagen =& new Paginator($pgx, $thisfile, $_SESSION['sess_searchkey'], $root_path);
 $GLOBAL_CONFIG = array();
 include_once $root_path . 'include/care_api_classes/class_globalconfig.php';
 $glob_obj = new GlobalConfig($GLOBAL_CONFIG);
 # Get the max nr of rows from global config
 $glob_obj->getConfig('pagin_patient_search_max_block_rows');
 if (empty($GLOBAL_CONFIG['pagin_patient_search_max_block_rows'])) {
     $pagen->setMaxCount(MAX_BLOCK_ROWS);
 } else {
     $pagen->setMaxCount($GLOBAL_CONFIG['pagin_patient_search_max_block_rows']);
 }
 # Detect what type of sort item
 if ($oitem == 'encounter_nr') {
     $tab = 'e';
 } elseif (stristr($oitem, 'op_')) {
     $tab = 'o';
 } else {
     $tab = 'p';
 }
Example #22
0
<?php

$id_service = Lib::isDefined("id_service");
require_once '../inc/php.php';
$globalConfig = new GlobalConfig();
$logo = $globalConfig->getConf()->getApplicationLogo();
?>

<TABLE WIDTH="150" BORDER="0" CELLPADDING="0" CELLSPACING="0" valign="top"  bgcolor="FFE5B2">
  <TR  bgcolor="FFCC66">
    <TD WIDTH="10" HEIGHT="1"  bgcolor="FFCC66"><img src=../lib/images/espaceur.gif width="1" height="1" >
    </TD>
    <TD WIDTH="29" HEIGHT="1"><img src=../lib/images/espaceur.gif width="1" height="1">
    </TD>
    <TD WIDTH="65" HEIGHT="1">&nbsp; </TD>
    <TD WIDTH="36" HEIGHT="1"><img src=../lib/images/espaceur.gif width="1" height="1">
    </TD>
    <TD WIDTH="11" HEIGHT="1"><img src=../lib/images/espaceur.gif width="1" height="1">
    </TD>
  </TR>
  <tr  bgcolor="FFCC66">
    <td width="10" height="1" bgcolor="FFCC66"><img src=../lib/images/espaceur.gif width="1" height="1">
    </td>
    <td width="29" height="1" bgcolor="FFCC66"><img src=../lib/images/espaceur.gif width="1" height="1">
    </td>
    <td width="65" height="1" bgcolor="FFCC66">&nbsp; </td>
    <td width="36" height="1" bgcolor="FFCC66"><img src=../lib/images/espaceur.gif width="1" height="1">
    </td>
    <td width="10" height="1" bgcolor="FFCC66"><img src=../lib/images/espaceur.gif width="1" height="1">
    </td>
  </tr>
Example #23
0
 * MIT License
 * see LICENSE.txt for more information
 */
/**
 * Use Composer autoloader to automatically load library classes.
 */
try {
    if (!file_exists('./vendor/autoload.php')) {
        throw new Exception('Dependencies managed by Composer missing. Please run "php composer.phar install".');
    }
    require_once 'vendor/autoload.php';
} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
    return;
}
$config = new GlobalConfig();
$model = new Model($config);
$controller = new WebController($model);
$request = new Request($model);
// PATH_INFO, for example "/ysa/fi"
$path = $request->getServerConstant('PATH_INFO') ? $request->getServerConstant('PATH_INFO') : '';
$parts = explode('/', $path);
if (sizeof($parts) <= 2) {
    // if language code missing, redirect to guessed language
    // in any case, redirect to <lang>/
    $lang = sizeof($parts) == 2 && $parts[1] !== '' ? $parts[1] : $controller->guessLanguage();
    header("Location: " . $lang . "/");
} else {
    if (array_key_exists($parts[1], $config->getLanguages())) {
        // global pages
        $request->setLang($parts[1]);
Example #24
0
require_once '../lib/class/html/HtmlSubForm_RNN.php';
require_once '../lib/class/html/HtmlTextArea.php';
require_once '../lib/class/html/HtmlCheckbox.php';
require_once '../lib/class/html/TraitDataFieldToHtml.php';
require_once '../lib/class/html/DataFieldToHtmlInputText.php';
require_once '../lib/class/html/DataFieldToHtmlListSelect.php';
require_once '../lib/class/html/DataFieldToHtmlListBoolean.php';
require_once '../lib/class/html/DataFieldToHtmlInputCalendar.php';
require_once '../lib/class/html/DataFieldToHtmlInputNumber.php';
require_once '../lib/class/html/DataFieldToHtmlTextArea.php';
require_once '../lib/class/html/DataFieldToHtmlSubForm_R1N.php';
require_once '../lib/class/html/DataFieldToHtmlSubForm_RNN.php';
require_once '../lib/class/ModuleConfigLib.php';
// Session utilisateur
require_once '../lib/session.php';
// Variables locales à la page PHP
Lib::setModule();
$module = Lib::getModule();
// Inclusions propres au module
if ($module != 'lib') {
    //Inclusion de la configuration propre au module
    $module_conf_file = '../' . $module . '/class/ModuleConfig.php';
    if (file_exists($module_conf_file)) {
        require_once $module_conf_file;
    }
    //Inclusion de la librairie de fonction propre au module
    require_once '../' . $module . '/functions.php';
}
//$globalConfig = $_SESSION['globalConfig'];
GlobalConfig::setExecDebugTimeStart();
Example #25
0
 * No settings should be added to this file that would need to be changed
 * on a per-machine basic (ie local, staging or production).  Any
 * machine-specific settings should be added to _machine_config.php
 */
/**
 * APPLICATION ROOT DIRECTORY
 * If the application doesn't detect this correctly then it can be set explicitly
 */
if (!GlobalConfig::$APP_ROOT) {
    GlobalConfig::$APP_ROOT = realpath("./");
}
/**
 * INCLUDE PATH
 * Adjust the include path as necessary so PHP can locate required libraries
 */
set_include_path(GlobalConfig::$APP_ROOT . '/libs/' . PATH_SEPARATOR . GlobalConfig::$APP_ROOT . '/../libs/' . PATH_SEPARATOR . get_include_path());
/**
 * RENDER ENGINE
 */
require_once 'verysimple/Phreeze/SavantRenderEngine.php';
GlobalConfig::$TEMPLATE_ENGINE = 'SavantRenderEngine';
GlobalConfig::$TEMPLATE_PATH = GlobalConfig::$APP_ROOT . '/templates/';
GlobalConfig::$TEMPLATE_CACHE_PATH = '';
/**
 * ROUTE MAP
 * The route map connects URLs to Controller+Method and additionally maps the
 * wildcards to a named parameter so that they are accessible inside the
 * Controller without having to parse the URL for parameters such as IDs
 */
GlobalConfig::$ROUTE_MAP = array('GET:' => array('route' => 'Default.Home'), 'POST:generate' => array('route' => 'Generator.Generate'), 'POST:analyze' => array('route' => 'Analyzer.Analyze'));
Example #26
0
<?php

//  require("../lib/session.php");
//  include("functions.php");
//  include("../lib/functions.php");
require_once '../inc/main.php';
$globalConfig = new GlobalConfig();
$login = $globalConfig->getAuthenticatedUser()->getKeyValue();
$id_user = $globalConfig->getAuthenticatedUser()->getKeyValue();
$pass = $globalConfig->getAuthenticatedUser()->getDataField(UserModel::FIELDNAME_PASSWORD)->getFieldValue();
$id_type = $globalConfig->getAuthenticatedUser()->getDataField(UserModel::FIELDNAME_ID_TYPE)->getFieldValue();
identification1("salaries", $login, $pass, FALSE);
//echo"lettre old :$lettreold<br>";
if ($inserer == 'inserer') {
    /* Insertion dans la table geo */
    if ($geo != '') {
        $geo = addslashes($geo);
        $lettre = strtoupper($lettre);
        // verification existence lettre
        $req = "select * from geo where lettre='{$lettrenew}'";
        $result = DatabaseOperation::query($req);
        $nb = mysql_num_rows($result);
        if (!$nb) {
            $req = "insert into geo (geo,lettre) values ('{$geo}','{$lettrenew}')";
            $result = DatabaseOperation::query($req);
        }
    }
}
if ($modifier == 'modifier') {
    /* Insertion dans la table geo */
    if ($geo != '') {
* Copyright 2002,2003,2004,2005 Elpidio Latorilla
* elpidio@care2x.org, 
*
* See the file "copy_notice.txt" for the licence notice
*/
define('LANG_FILE', 'doctors.php');
define('NO_2LEVEL_CHK', 1);
require_once $root_path . 'include/inc_front_chain_lang.php';
require_once $root_path . 'include/care_api_classes/class_personell.php';
$pers_obj = new Personell();
$person =& $pers_obj->getPersonellInfo($nr);
require_once $root_path . 'include/care_api_classes/class_department.php';
$dept_obj = new Department();
$dept =& $dept_obj->getPhoneInfo($dept_nr);
require_once $root_path . 'include/care_api_classes/class_globalconfig.php';
$glob_obj = new GlobalConfig($GLOBAL_CONFIG);
$glob_obj->getConfig('person_%');
/* Check whether config foto path exists, else use default path */
$default_photo_path = 'fotos/registration';
$photo_filename = $person['photo_filename'];
$photo_path = is_dir($root_path . $GLOBAL_CONFIG['person_foto_path']) ? $GLOBAL_CONFIG['person_foto_path'] : $default_photo_path;
require_once $root_path . 'include/inc_photo_filename_resolve.php';
html_rtl($lang);
?>
<HEAD>
<?php 
echo setCharSet();
?>
<TITLE><?php 
echo $LDInfo4Duty;
?>
define('LANG_FILE', 'edp.php');
$local_user = '******';
require_once $root_path . 'include/inc_front_chain_lang.php';
$breakfile = 'edv-system-admi-welcome.php' . URL_APPEND;
if ($from == 'add') {
    $returnfile = 'edv_system_format_menu_item_add.php' . URL_APPEND . '&from=set';
} else {
    $returnfile = $breakfile;
}
$thisfile = basename($_SERVER['PHP_SELF']);
$editfile = 'edv_system_format_menu_item_add.php' . URL_REDIRECT_APPEND . '&mode=edit&from=set&item_no=';
if (!isset($GCONFIG)) {
    $GCONFIG = array();
}
require_once $root_path . 'include/care_api_classes/class_globalconfig.php';
$gc = new GlobalConfig($GCONFIG);
if (isset($mode) && $mode == 'save' && !empty($max_items)) {
    $gc->saveConfigItem('theme_control_buttons', $_POST['theme_control_buttons']);
    header('location:' . $thisfile . URL_REDIRECT_APPEND . '&mode=0');
    exit;
}
# Start Smarty templating here
/**
 * LOAD Smarty
 */
# Note: it is advisable to load this after the inc_front_chain_lang.php so
# that the smarty script can use the user configured template theme
require_once $root_path . 'gui/smarty_template/smarty_care.class.php';
$smarty = new smarty_care('system_admin');
# Title in toolbar
$smarty->assign('sToolbarTitle', $LDTheme);
/* Retrieve the SIGNAL_COLOR_LEVEL_ZERO = for convenience purposes */
$z = SIGNAL_COLOR_LEVEL_ZERO;
/* Retrieve the SIGNAL_COLOR_LEVEL_FULL = for convenience purposes */
$f = SIGNAL_COLOR_LEVEL_FULL;
$_SESSION['sess_user_origin'] = 'nursing';
/* Create department object and load all medical depts */
require_once $root_path . 'include/care_api_classes/class_department.php';
$dept_obj = new Department();
$medical_depts = $dept_obj->getAllMedical();
/* Create encounter object */
require_once $root_path . 'include/care_api_classes/class_encounter.php';
$enc_obj = new Encounter();
/* Load global configs */
include_once $root_path . 'include/care_api_classes/class_globalconfig.php';
$GLOBAL_CONFIG = array();
$glob_obj = new GlobalConfig($GLOBAL_CONFIG);
$glob_obj->getConfig('patient_%');
$_SESSION['logID'] = $_SESSION['sess_user_name'];
function Spacer()
{
    /*?>
    <TR bgColor=#dddddd height=1>
                    <TD colSpan=3><IMG height=1
                      src="../../gui/img/common/default/pixel.gif"
                      width=5></TD></TR>
    <?php
    */
}
/* Establish db connection */
if (!isset($db) || !$db) {
    include $root_path . 'include/inc_db_makelink.php';
Example #30
0
<?php

/** @package    Pizzaria Meveana */
/* GlobalConfig object contains all configuration information for the app */
include_once "_global_config.php";
include_once "_app_config.php";
@(include_once "_machine_config.php");
if (!GlobalConfig::$CONNECTION_SETTING) {
    throw new Exception('GlobalConfig::$CONNECTION_SETTING is not configured.  Are you missing _machine_config.php?');
}
/* require framework libs */
require_once "verysimple/Phreeze/Dispatcher.php";
// the global config is used for all dependency injection
$gc = GlobalConfig::GetInstance();
try {
    Dispatcher::Dispatch($gc->GetPhreezer(), $gc->GetRenderEngine(), '', $gc->GetContext(), $gc->GetRouter());
} catch (exception $ex) {
    // This is the global error handler which will be called in the event of
    // uncaught errors.  If the endpoint appears to be an API request then
    // render it as JSON, otherwise attempt to render a friendly HTML page
    $url = RequestUtil::GetCurrentURL();
    $isApiRequest = strpos($url, 'api/') !== false;
    if ($isApiRequest) {
        $result = new stdClass();
        $result->success = false;
        $result->message = $ex->getMessage();
        $result->data = $ex->getTraceAsString();
        @header('HTTP/1.1 401 Unauthorized');
        echo json_encode($result);
    } else {
        $gc->GetRenderEngine()->assign("message", $ex->getMessage());