[go: up one dir, main page]

Menu

[r19]: / printout.php  Maximize  Restore  History

Download this file

145 lines (130 with data), 5.3 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<?php
//Send some headers to keep the user's browser from caching the response.
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
// start session
session_start();
// load classes
//require_once($_SERVER['DOCUMENT_ROOT'].$_SESSION['srcPath'].'/src/conf/cConfig.php');
//CONFIG::loadConfig();
require_once('conf/cConfig.php');
ngremacsCONFIG::loadConfig();
ngremacsCONFIG::loadPluginConfigIni();
require_once(('lang/lang.'.$_SESSION["language"]));
$lang_php = array_merge($lang_reg, $lang_php);
$db_models_name = 'db_models'.(ngremacsCONFIG::$loadCmpNgReMaCsPHP?'.cmp':'').'.php';
if(file_exists($db_models_name)) {
require_once($db_models_name);
} else {
exit('no database model file exist!!');
}
$exclude = array();
$languageDisable = !empty($_REQUEST['languageDisable']) AND $_REQUEST['languageDisable'] == 'true'? true:false;
$api = new DB_ngREMACS();
switch ($_REQUEST['namespace']) {
case 'ngremacs.getSportlerGrid':
$id = empty($_REQUEST['id']) ? NULL : $_REQUEST['id'];
$data = $api->getSingleSportlerDB($id);
$data = $data[0];
$data['geschlecht'] = $data['geschlecht'] == 'f' ? 'weiblich' : 'm&auml;nlich';
//replace _startberechtigt
$data['startberechtigt'] = $data['_startberechtigt'];
unset($data['_startberechtigt']);
break;
case 'ngremacs.getAthletsRegattaGrid':
$id = empty($_REQUEST['id']) ? NULL : $_REQUEST['id'];
$regid = empty($_REQUEST['regid']) ? NULL : $_REQUEST['regid'];
$data = $api->getSingleSportlerDB($id);
$data = $data[0];
$data['geschlecht'] = $data['geschlecht'] == 'f' ? 'weiblich' : 'm&auml;nnlich';
//replace _startberechtigt
$data['startberechtigt'] = $data['_startberechtigt'];
unset($data['_startberechtigt']);
//add data
if(($meld = $api->getMeldungenOfAthlet($id, $regid))!==False && !empty($meld)) {
$strHtml = '<table class="printOutAthletsRennen">';
$strHtml.= '<tr><th>Rennen</th><th>Platz</th><th>Status</th></tr>';
foreach($meld as $value) {
$strHtml.= '<tr><td>'.$value['nummer'].': '.$value['spezifikation'].'</td><td>'.($value['_platz']!=0 && $value['_platz']<99 ? $value['_platz']:'').'</td><td>'.$value['_status'].'</td></tr>';
}
$strHtml.='</table>';
$data[$lang_php['rennenRegGridPrefix']] = $strHtml;
}
break;
default:
break;
}
$data = array_exclude($data, $exclude);
function array_exclude(array $data, array $exclude = array()) {
foreach ($exclude as $field) {
if (is_array($field)) {
foreach ($data as $key => $value) {
$pos = strpos($key, $field['key']);
if ($pos !== false) {
if (($field['place'] == 'start' && $pos == 0) || ($field['place'] == 'end' && $pos == strlen($key)-strlen($field['key']))) {
unset($data[$key]);
}
}
}
} elseif (isset($data[$field])) {
unset($data[$field]);
}
}
return $data;
}
function implode_multi($glue, $array) {
global $lang_php;
$json = @json_decode($array, true);
if (!empty($json) && is_array($json)) {
$array = $json;
}
if (is_array($array)) {
foreach ($array as $key => &$value) {
if (is_array($value)) {
$value = '<li style="list-style:none;padding:0;margin:0">'.implode_multi(' ', CommonUtils::array_trim($value)).'</li>';
} else {
$value = '<li>'.$value.'</li>';
}
}
return '<ul>'.implode($glue, $array).'</ul>';
}
return $array;
}
function load_env()
{
global $lang_js, $lang_php;
$lang_php = array_merge($lang_js, $lang_php);
CONFIG::loadClasses();
CONFIG::loadScripts();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>printOut</title>
<meta <?php echo 'http-equiv="Content-Type" content="text/html; charset='.strtoupper(CONFIG::$encodingData).'"';?>>
<link type="text/css" rel="stylesheet" href="css/print.css" />
</head>
<body<?php echo (empty($_REQUEST['print']) ? null : ' >); ?>>
<table class="printOut" style="min-width: 600px;">
<tr>
<td class="header">FIELD NAME</td>
<td class="header">VALUE</td>
</tr>
<?php foreach ($data as $key => $value): ?>
<tr>
<?php if (strpos($key, '_value') !== false) continue; ?>
<?php if (empty($lang_php[$key])): ?>
<?php if($languageDisable): ?>
<td class="field"><?php echo ucfirst($key); ?></td>
<?php else: ?>
<td class="field unknown"><?php echo ucfirst($key); ?></td>
<?php endif; ?>
<?php else: ?>
<td class="field"><?php echo ucfirst($lang_php[$key]); ?></td>
<?php endif; ?>
<td class="value"><?php echo implode_multi(' ', $value) . (isset($data[$key . '_value']) ? ' (' . $data[$key . '_value'] . ')' : null); ?></td>
</tr>
<?php endforeach; ?>
</table>
</body>
</html>