Linux lhjmq-records 5.15.0-118-generic #128-Ubuntu SMP Fri Jul 5 09:28:59 UTC 2024 x86_64
Your IP : 13.59.5.179
<?php
// Include not systematic include library
include('../administration/lib/locations.php');
// Gets a participant in the correct form
function &local_get_participants($mysql_link, $on_date, $systype, $subtype, $id_register) {
$res = mysql_query($sql = 'SELECT r.*, rh.*, tpers.description_en AS typeperson, tpers.sysType, tpers.sysSubType
FROM register_histo AS rh
LEFT JOIN types_personnels AS tpers ON tpers.id_type_pers = rh.histo_addeddata
LEFT JOIN register AS r ON r.id = rh.id_register
WHERE rh.sys_date <= "'.$on_date.' 23:59:59"
AND rh.histo_type = '.HISTO_LEAGUE.'
AND rh.id_register = '.$id_register.'
ORDER BY rh.sys_date, rh.id', $mysql_link);
$events = array();
while ($resitem = mysql_fetch_assoc($res)) {
$events[$resitem['sys_date']][] = $resitem;
}
$participants = array();
foreach ($events as $eventday) {
if (is_array($eventday)) {
foreach ($eventday as $event) {
if ($event['histo_status'] == 'IN' && $event['sysType'] == $systype && $event['sysSubType'] == $subtype) {
$participants[$event['id_register']] = $event;
}
/*
Modification par Vadim (2007-02-16)
else if ($event['histo_status'] == 'OUT') {
unset($participants[$event['id_register']]);
}
*/
}
}
}
return $participants;
}
// Get the item
$register = local_get_participants($mysql_link, date('Y-m-d'), 2, 0, $_GET['id_register']);
$location = mysql_fetch_assoc(mysql_query('SELECT rl.loc_city, rl.loc_province, rl.loc_country, rl.loc_postalcode FROM register_locations AS rl WHERE id_register = '.mysql_escape_string(stripslashes($_GET['id_register'])).' AND rl.sys_scope = '.SCOPE_PUBLIC.' AND rl.sys_status = '.STATUS_ACTIVE.' AND rl.loc_type = '.LOC_BIRTH.' GROUP BY id_register ORDER BY rl.sys_status DESC', $mysql_link));
$photos = @mysql_fetch_assoc(@mysql_query($sql = 'SELECT rp.id AS photoid, rp.pic_large, rp.pic_small FROM register_photos AS rp WHERE sys_date <= "'.date('Y-m-d').'" AND id_register = '.mysql_escape_string(stripslashes($_GET['id_register'])).' AND rp.sys_scope = '.SCOPE_PUBLIC.' AND rp.sys_status = '.STATUS_ACTIVE.' GROUP BY photoid ORDER BY rp.sys_status DESC, rp.sys_date DESC, rp.id DESC', $mysql_link));
$register = array_merge($register[$_GET['id_register']], $location, $photos);
unset($location);
// Build the history of this officer (manual and automatic histo)
$autohistory = mysql_query('SELECT rh.*, tpers.description_en AS description FROM register_histo as rh LEFT JOIN types_personnels AS tpers ON tpers.id_type_pers = rh.histo_addeddata WHERE histo_type IN ('.HISTO_LEAGUE.', '.HISTO_TEAM.', '.HISTO_TRANSFER.', '.HISTO_LIBERATION.') AND id_register = '.$_GET['id_register'].' AND sys_date <= "'.date('Y-m-d').'" ORDER BY sys_date, id, histo_type', $mysql_link);
$manualhistory = mysql_query('SELECT * FROM register_manualhisto WHERE sys_status = '.STATUS_ACTIVE.' AND sys_scope = '.SCOPE_PUBLIC.' AND id_register = '.$_GET['id_register'].' AND sys_date <= "'.date('Y-m-d').'" ORDER BY sys_date, id', $mysql_link);
$history = array();
while ($histo = mysql_fetch_assoc($autohistory)) {
if ($histo['histo_type'] == HISTO_LIBERATION) {
$last_histo = $histo;
} else if (!is_null($last_histo) && $last_histo['histo_type'] == HISTO_LIBERATION && $histo['histo_type'] == HISTO_TRANSFER) {
$last_histo = $histo;
} else if (!is_null($last_histo) && $last_histo['histo_type'] == HISTO_TRANSFER && $histo['histo_type'] == HISTO_TEAM) {
$histo['flag_transfer'] = 1;
$history[$histo['sys_date']][] = $histo;
$last_histo = NULL;
} else if (!is_null($last_histo) && $histo['histo_type'] != HISTO_TRANSFER) {
if (!is_null($last_histo)) {
$history[$last_histo['sys_date']][] = $last_histo;
}
$history[$histo['sys_date']][] = $histo;
$last_histo = NULL;
} else {
$history[$histo['sys_date']][] = $histo;
$last_histo = NULL;
}
}
while ($histo = mysql_fetch_assoc($manualhistory)) {
$history[$histo['sys_date']][] = $histo;
}
ksort($history);
?>
<table width="631" border="0" cellspacing="0" cellpadding="5">
<tr>
<td align="center">
<table width="598" border="0" cellspacing="0" cellpadding="0" class="outlinetab">
<tr class="darkblueRow">
<td nowrap class="blackText10px"> </td>
</tr>
<tr>
<td nowrap class="blackText10px">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="161"> </td>
<td width="25"> </td>
<td> </td>
<td width="150"> </td>
</tr>
<tr>
<td width="161" rowspan="9" align="center" valign="top">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20" rowspan="3"> </td>
<td width="121"><img src="../../images/honors/imahonors-hautlinktable.gif" width="121" height="13"></td>
<td rowspan="3" width="20"> </td>
</tr>
<tr>
<td bgcolor="#FFFFFF" valign="top">
<table width="121" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1" bgcolor="#A6ACBF"><img src="../../images/spacer.gif" width="1" height="1"></td>
<td width="119" valign="top" align="center">
<?php if ($register['pic_large'] != '') { ?>
<img src="<?= $register['pic_large'] ?>" border="0">
<?php } else { ?>
<img src="images/personnels/photo_nd.jpg" width="95" height="141" border="0">
<?php } ?>
</td>
<td width="1" bgcolor="#A6ACBF"><img src="../../images/spacer.gif" width="1" height="1"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td><img src="../../images/honors/imahonors-baslinktable.gif" width="121" height="18"></td>
</tr>
</table>
</td>
<td width="25"> </td>
<td class="blackText16px" style="text-transform: uppercase; font-weight:900"><?= ($register['info_basicnumber'] != '' ? '#'.$register['info_basicnumber'] : '') ?> <?= $register['info_lname'].', '.$register['info_fname'] ?></td>
<td width="150" rowspan="9" align="center"><img src="../images/publicity/lhjmq1a.jpg"></td>
</tr>
<tr>
<td width="25"> </td>
<td class="blackText14px"><?= $register['typeperson'] ?></td>
</tr>
<tr>
<td width="25"> </td>
<td> </td>
</tr>
<tr>
<td width="25"> </td>
<td> </td>
</tr>
<tr>
<td width="25"> </td>
<td class="blackText10px"><b><b>Place of birth</b> :</b> <?= address_makefulltitle($register, 9) ?></td>
</tr>
<tr>
<td width="25"> </td>
<td class="blackText10px"><b><b>Birth date</b> :</b> <?= $register['info_datenais'] ?></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td width="25"> </td>
<td> </td>
</tr>
<tr>
<td width="161"> </td>
<td width="25"> </td>
<td> </td>
<td width="150"> </td>
</tr>
</table>
</td>
</tr>
</table>
<table width="598" cellpadding="0" cellspacing="0" border="0" align="center" class="outlinetab">
<tr class="darkblueRow whiteText11px">
<td nowrap style="padding: 5px"><b>Career notes</b></td>
</tr>
<tr>
<td nowrap class="blackText10px">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<?php foreach ($history as $date => $items) { foreach ($items as $item) { $ilist++; ?>
<tr class="list<?= ($ilist % 2) + 1 ?>Reg">
<td width="25"> </td>
<td width="85" class="blackText10px"><?= substr($item['sys_date'], 0, 10) ?></td>
<td class="blackText10px"><?= (isset($item['histo_type']) ? draw_histo($mysql_link, $item) : nl2br($item['info_data_en'])) ?></td>
<td width="25"> </td>
</tr>
<?php } } ?>
</table>
</td>
</tr>
</table>
<br />
<table width="621" border="0" cellspacing="0" cellpadding="0" bgcolor="#546085">
<tr>
<td><img src="../../images/spacer.gif" width="621" height="1"></td>
</tr>
</table>
</td>
</tr>
</table>
<?php
function draw_histo($mysql_link, $item) {
switch ($item['histo_type']) {
case HISTO_LEAGUE:
if ($item['histo_status'] == 'IN') {
$leaguedata = league_get_data($mysql_link, $item['histo_directdata']);
return 'Entered "<i>'.$leaguedata[$item['histo_directdata']]['description_en'].'</i>" as a <i>"'.$item['description'].'"</i>';
} else {
$leaguedata = league_get_data($mysql_link, $item['histo_directdata']);
return 'Exited "<i>'.$leaguedata[$item['histo_directdata']]['description_en'].'</i>"';
}
break;
case HISTO_TEAM:
$teamdata = team_get_data($mysql_link, $item['histo_directdata'], $item['sys_date']);
if ($item['flag_transfer'] == 1) {
return 'Traded to "<i>'.$teamdata[$item['histo_directdata']]['hist_city'].'</i>"';
} else {
if ($item['histo_status'] == 'EMPLOY') {
return 'Employed by "<i>'.$teamdata[$item['histo_directdata']]['hist_city'].'</i>"';
} else {
return 'Recruted by "<i>'.$teamdata[$item['histo_directdata']]['hist_city'].'</i>"';
}
}
break;
case HISTO_LIBERATION:
$teamdata = team_get_data($mysql_link, $item['histo_directdata'], $item['sys_date']);
return 'Liberated from "<i>'.$teamdata[$item['histo_directdata']]['hist_city'].'</i>"';
break;
}
}
?>
|