/** * purpose security controlled membership listing + action buttons for non public access * params * returns HTML Table with rows */ function _listMemberShip($player_id, $verein_id, $mtype_id, $verband_ID, $m_active) { global $dbi, $usertoken; /* create a meaningful type_comparison string */ if ($mtype_id > 0) { $type_comp = '=' . $mtype_id; } else { die_red('Err157:MemberTypeRequired'); } $RS = DB_listMemberShips($dbi, $player_id, $verein_id, $type_comp, $m_active, $verband_ID); if (sizeof($RS) > 2000) { die_red('Selection returns more than 2000 rows (' . sizeof($RS) . ')'); } if (sizeof($RS) < 1) { die_green('Search criteria returns nothing ...'); } /* * no actions for non-registermap members ... */ if (sizeof($usertoken['registermap']) < 1) { $aTH = array('Verein', 'Meldeart', 'PassNr', 'Meldung Ende', 'ID', 'Vorname', 'Nachname'); $ROWS = RecordsetToDataTable($RS, array(2, 3, 4, 5, 6, 7, 8)); } else { $aTH = array('Verein', 'Meldeart', 'PassNr', 'Meldung Ende', 'ID', 'Vorname', 'Nachname', 'Aktion'); $ROWS = RecordsetToDataTable($RS, array(2, 3, 4, 5, 6, 7, 8), array('playeredit', 'memberdel'), array(array(6), array(0, 6)), array('Edit Player', 'Del')); } $HEAD = ArrayToTableHead($aTH); $sum = '<div>Search criteria returned ' . sizeof($RS) . ' records.</div>'; return $sum . '<table class="tchild" id="tmembers" name="tmembers">' . $HEAD . $ROWS . '</table>'; }
/** * purpose: render table with active memberships for specified player * params: player_id * returns: TABLE */ function LSTable_PlayerActiveMemberShips($idname, $player_id) { global $dbi; $ROWS = ''; $HEAD = ''; $RS = DB_listMemberShips($dbi, $player_id, 0, '>0', 1); $aTH = array('id', 'Verein', 'Art', 'PassNr', 'Ende', 'Vorname', 'Nachname', 'Aktion'); $HEAD = ArrayToTableHead($aTH); $ROWS = RecordsetToDataTable($RS, array(0, 2, 3, 4, 5, 7, 8), array('memberedit', 'memberdel'), array(array(0, 6), array(0, 6)), array('Edit', 'Del')); return '<table class="tchild" id="' . $idname . '" name="' . $idname . '">' . $HEAD . $ROWS . '</table>'; }
} else { $player_id = 0; } # this is either 'true' or 'undefined' if (isset($_POST['mactive']) && strip_tags($_POST['mactive']) == 'true') { $m_active = 1; } else { $m_active = 0; } /* * security check on the length of params ... */ if ($m_code > 0) { $type_comp = '=' . $m_code; } else { $type_comp = '>0'; } $dbi = sql_connect($dbhost, $dbuname, $dbpass, $dbname); $RS = DB_listMemberShips($dbi, $player_id, $verein_id, $type_comp, $m_active, $m_realm); if (sizeof($RS) > 2000) { die_red('Selection returns more than 2000 rows (' . sizeof($RS) . ')'); } if (sizeof($RS) < 1) { die_green('Search criteria returns nothing ...'); } $aTH = array('Verein', 'Meldeart', 'PassNr', 'Meldung Ende', 'Vorname', 'Nachname'); $ROWS = RecordsetToDataTable($RS, array(2, 3, 4, 5, 7, 8)); $HEAD = ArrayToTableHead($aTH); header('Content-Type: application/html; charset=ISO-8859-1'); echo '<table class="tchild" id="tmembers" name="tmembers">' . $HEAD . $ROWS . '</table>'; debug('Search criteria returned ' . sizeof($RS) . ' records.');