setJavascript ("/js/jquery.form.js"); $htmlhead->setJavascript ("/js/jquery.validate.js"); $htmlhead->setJavascript ("/js/additional-methods.js"); $htmlhead->setJavascript ("/module/insurance/accident_logic.js"); $post = (!empty ($_SESSION['post']) AND (sizeof ($_SESSION['post']) > 0)) ? $_SESSION['post'] : $userinfo; $partner_id = is_numeric ($_POST['partner_id']) ? $_POST['partner_id'] : false ; if (($partner_id != false) AND (isset ($_POST['partner_id']))) { $post = $_POST; $htmlhead->setJavascript ("/module/insurance/partner_accident_logic.js"); $program_id = $_POST['program']; $period_id = 17; $summa_id = 16; } else { $program_id = 1; $period_id = 8; $summa_id = 11; } if (msg::checkConfirm()) { $error = msg::getConfirm(); } if (msg::checkError()) { $error = msg::getError(); } $id = is_numeric ($_GET['id']) ? $_GET['id'] : false ; if (($id != false) AND (isset ($_SESSION['id']))) { $accident = new accident; $accident->sql_link = $sql; $post = $accident->getOrderInfo($id, $_SESSION['id']); $post = array_merge($post, $userinfo); $htmlhead->setJavascript ("/module/insurance/save_accident_logic.js"); } $signin = (isset ($_SESSION['signin']) AND ($_SESSION['signin'] === true)) ? 'true' : 'false' ; $lang_id = constant ("LANG"); $query = "SELECT * FROM `accident_program` WHERE (`lang` = '{$lang_id}') ORDER BY `key` ASC"; $a = $sql->QuickResult ( $query ); foreach ($a as $k=>$v) { $program_value['key'][$k]=$v['key']; $program_value['value'][$k]=$v['name']; } $query = "SELECT * FROM `accident_old` WHERE (`lang` = '{$lang_id}') AND (`program`='{$program_id}') ORDER BY `key` ASC"; $a = $sql->QuickResult ( $query ); foreach ($a as $k=>$v) { $child_old_value['key'][$k]=$v['key']; $child_old_value['value'][$k]=$v['name']; } $query = "SELECT * FROM `accident_sport` WHERE (`lang` = '{$lang_id}') ORDER BY `key` ASC"; $a = $sql->QuickResult ( $query ); foreach ($a as $k=>$v) { $sport_deal_value['key'][$k]=$v['key']; $sport_deal_value['value'][$k]=$v['name']; } $query = "SELECT * FROM `accident_sport_type` WHERE (`lang` = '{$lang_id}') ORDER BY `key` ASC"; $a = $sql->QuickResult ( $query ); foreach ($a as $k=>$v) { $sport_type_value['key'][$k]=$v['key']; $sport_type_value['value'][$k]=$v['name']; } $query = "SELECT * FROM `accident_activity` WHERE (`lang` = '{$lang_id}') ORDER BY `key` ASC"; $a = $sql->QuickResult ( $query ); foreach ($a as $k=>$v) { $activity_type_value['key'][$k]=$v['key']; $activity_type_value['value'][$k]=$v['name']; } $query = "SELECT * FROM `accident_period` WHERE (`lang` = '{$lang_id}') ORDER BY `key` ASC"; $a = $sql->QuickResult ( $query ); foreach ($a as $k=>$v) { if ($v['key'] < $period_id) { $period_value['key'][$k]=$v['key']; $period_value['value'][$k]=$v['name']; } } $query = "SELECT * FROM `accident_summa` WHERE (`lang` = '{$lang_id}') ORDER BY `key` ASC"; $a = $sql->QuickResult ( $query ); foreach ($a as $k=>$v) { if ($v['key'] < $summa_id) { $summa_value['key'][$k]=$v['key']; $summa_value['value'][$k]=$v['name']; } } $query = "SELECT * FROM `tooltip` WHERE (`lang` = '{$lang_id}') AND (`calculatorId` = '5') ORDER BY `id` ASC"; $a = $sql->QuickResult ( $query ); foreach ($a as $k=>$v) { $tooltip_value[$v['itemId']] = $v['value']; } for ($i = 1; $i <= 31; $i++) { $count_day[] = $i; } for ($i = date( "Y"); $i >= (date( "Y")-80); $i--) { $count_year[] = $i; } $smarty->assign ("post",$post); $smarty->assign ("error",$error); $smarty->assign ("program_value",$program_value); $smarty->assign ("old_value",$child_old_value); $smarty->assign ("sport_deal_value",$sport_deal_value); $smarty->assign ("sport_type_value",$sport_type_value); $smarty->assign ("activity_type_value",$activity_type_value); $smarty->assign ("period_value",$period_value); $smarty->assign ("summa_value",$summa_value); $smarty->assign ("count_day",$count_day); $smarty->assign ("count_year",$count_year); $smarty->assign ("count_month",array(1,2,3,4,5,6,7,8,9,10,11,12)); $smarty->assign("tooltip_value",$tooltip_value); $smarty->assign ("signin",$signin); $smarty->display ("insurance/accident.tpl"); $_SESSION['post'] = false; ?>