<?php
// Skills für Userdetails
defined ('main') or die ('no direct access');
defined ('admin') or die ('only admin access');
$design = new design ('Admins Area', 'Admins Area', 2);
$design->header();
echo '
<script language="JavaScript" type="text/javascript">
<!--
function skilldel ( SKILLID ) {
var frage = confirm ( "Willst du diesen Eintrag wirklich entfernen?" );
if ( frage == true ) {
document.location.href="?skills-del-"+SKILLID;
}
}
function skillname ( SKILLID ) {
var frage = window.prompt("Bitte geben Sie den neuen Namen ein", "");
if (frage != null) {
document.location.href="?skills-name-"+SKILLID+"-"+frage;
}
}
function skillnew () {
var newname = window.prompt("Bitte geben Sie den Namen des Skill ein", "");
document.location.href="?skills-newskill-"+newname;
}
function catnew () {
var newname = window.prompt("Bitte geben Sie den Namen der Kategorie an", "");
document.location.href="?skills-newcat-"+newname;
}
-->
</script>';
echo '
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td><img src="include/images/icons/admin/skills.png" /></td>
<td width="30"></td><td valign="bottom"><h1>Skills</h1></td>
</tr>
</table>
<table width="520" cellpadding="3" cellspacing="1" border="0" class="border">
<tr class="Cdark">
<td width="50" align="center">Pos</td>
<td width="470" colspan="5">Skillname<span style="float:right"><a href="javascript:catnew()"><b>Neue Kategorie</b></a> | <a href="javascript:skillnew()"><b>Neuer Skill</b></a></span></td>
</tr>
<tr class="Cmite">
<td colspan="6" height="5"></td>
</tr>';
//
if ($menu->get(1) == 'del') {
db_query('DELETE FROM `prefix_skill` WHERE id = "' . $menu->get(2) . '" LIMIT 1');
}
if ($menu->get(1) == 'name') {
$name = escape($_SERVER["REQUEST_URI"],'string');
$name = str_replace('/admin.php?skills-name-'.$menu->get(2).'-', '', $name);
$name = urldecode($name);
db_query('UPDATE `prefix_skill` SET name = "' . $name . '" WHERE id = "' . $menu->get(2) . '"');
}
if ($menu->get(1) == 'newskill' and $menu->get(2) != 'null' and $menu->get(2) != '') {
$name = escape($_SERVER["REQUEST_URI"],'string');
$name = str_replace('/admin.php?skills-newskill-', '', $name);
$name = urldecode($name);
$maxpos = db_result(db_query('SELECT pos FROM `prefix_skill` ORDER BY pos DESC LIMIT 1'),0) + 1;
db_query('INSERT INTO prefix_skill (`pos` , `name`) VALUES ("' . $maxpos . '", "' . $name . '")');
}
if ($menu->get(1) == 'newcat' and $menu->get(2) != 'null' and $menu->get(2) != '') {
$name = escape($_SERVER["REQUEST_URI"],'string');
$name = str_replace('/admin.php?skills-newcat-', '', $name);
$name = urldecode($name);
$maxpos = db_result(db_query('SELECT pos FROM `prefix_skill` ORDER BY pos DESC LIMIT 1'),0) + 1;
db_query('INSERT INTO prefix_skill (`pos` , `name`, `cat`) VALUES ("' . $maxpos . '", "' . $name . '", 1)');
}
if ($menu->getA(1) == 'o' OR $menu->getA(1) == 'u') {
$pos = $menu->get(2);
$id = $menu->getE(1);
$nps = ($menu->getA(1) == 'u' ? $pos + 1 : $pos - 1);
$anz = db_result(db_query("SELECT COUNT(*) FROM prefix_skill"), 0);
if ($nps <= $anz AND $nps >= 1) {
db_query("UPDATE prefix_skill SET pos = " . $pos . " WHERE pos = " . $nps);
db_query("UPDATE prefix_skill SET pos = " . $nps . " WHERE id = " . $id);
}
}
//
$erg = db_query('SELECT * FROM `prefix_skill` ORDER BY pos, name DESC');
$class = '';
while ($row = db_fetch_object($erg)) {
if ($row->cat == 1) {
$class = 'Cnorm';
echo '<tr class="Cdark">';
} else {
if ($class == 'Cmite') { $class = 'Cnorm'; } else { $class = 'Cmite'; }
echo '<tr class="' . $class . '">';
}
echo '<td width="50" align="center">' . $row->pos . '</td>
<td width="440">' . $row->name . '</td>
<td width="10" align="center">
<a href="javascript:skillname(' . $row->id . ')"><img src="include/images/icons/edit.gif" alt="umbenennen" title="umbenennen"></a></td>
<td width="10" align="center">
<a href="javascript:skilldel(' . $row->id . ')"><img src="include/images/icons/del.gif" alt="löschen" title="löschen"></a></td>
<td width="10" align="center">
<a href="?skills-o' . $row->id . '-' . $row->pos . '"><img src="include/images/icons/pfeilo.gif" border="0" title="oben" alt="oben"></a></td>
<td width="10" align="center">
<a href="?skills-u' . $row->id . '-' . $row->pos . '"><img src="include/images/icons/pfeilu.gif" border="0" title="unten" alt="unten"></a></td>
</tr>';
}
echo '</table>';
$design->footer();
?>