Hallo, Gast! (Registrieren)

Letzte Ankündigung: MyBB 1.8.37 veröffentlicht (04.11.23)


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste
Edit-Funktion im ACP
#1
Guten Abend!

Für mein Harry Potter-Forum möchte ich eine Liste der Buchcharaktere haben, die ich über das ACP steuern kann: Charaktere eintragen, bearbeiten und löschen. Dafür habe ich zunächst in der Datenbank eine neue Tabelle "bookcharas" mit den entsprechenden Spalten erstellt.

   

Um das Ganze ins ACP zu bringen, haben ich unter /admin/modules/home eine neue Funktion eingefügt. Als Ausgangslage für die bookcharas.php diente mir dabei die /admin/modules/user/titles.php, die ich einfach nur kopiert und für meine Belange angepasst habe. Die Funktion mit der entsprechenden Übersicht ist auch tatsächlich im ACP gelandet! Zu Testzwecken habe ich einen Buchcharakter direkt in der Datenbank erstellt.

   

Als nächstes wollte ich die Editierfunktion hinzufügen, aber daran scheitert es jetzt leider schon. xD Ich hab wieder den Code aus der /admin/modules/user/titles.php genommen und angepasst, aber da ich nicht so der große php-Profi bin, erscheint jetzt nur eine weiße Seite, wenn ich die Buchcharaktere im ACP aufrufen will.

Vielleicht mag ja mal jemand über meine php-Datei schauen? (: Die Sprachvariablen sind erst mal egal, die änder ich, sobald alles funktioniert. Bei Bedarf kann ich auch gern die Zugangsdaten fürs Forum und/oder FTP via PN weiterleiten. (:

Allerliebste Grüße,
Anne 

PHP-Code:
<?php
/**
 *
 * Buchcharaktere
 *
 */

// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
die(
"Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

$page->add_breadcrumb_item($lang->home_bookcharas"index.php?module=home-bookcharas");

if(
$mybb->input['action'] == "add" || !$mybb->input['action'])
{
$sub_tabs['manage_titles'] = array(
'title' => $lang->home_bookcharas,
'link' => "index.php?module=home-bookcharas",
'description' => $lang->home_bookcharas_desc
);
$sub_tabs['add_title'] = array(
'title' => $lang->add_new_bookchara,
'link' => "index.php?module=home-bookcharas&amp;action=add",
'description' => $lang->add_new_bookchara_desc
);
}

$plugins->run_hooks("admin_user_titles_begin");

if(
$mybb->input['action'] == "edit")
{
$query $db->simple_select("bookcharas""*""bcid='".$mybb->get_input('bcid'MyBB::INPUT_INT)."'");
$bookcharas $db->fetch_array($query);

if(!
$bookcharas['bcid'])
{
flash_message($lang->error_invalid_user_title'error');
admin_redirect("index.php?module=home-bookcharas");
}

$plugins->run_hooks("admin_user_titles_edit");

if(
$mybb->request_method == "post")
{
if(!
trim($mybb->input['name']))
{
$errors[] = $lang->error_missing_title;
}

if(!
$errors)
{
$updated_title = array(
"name" => $db->escape_string($mybb->input['name']),
"status" => $db->escape_string($mybb->input['status']),
"alter" => $db->escape_string($mybb->input['alter']),
"blutstatus" => $db->escape_string($mybb->input['blutstatus']),
"beruf" => $db->escape_string($mybb->input['beruf']),
"gesinnung" => $db->escape_string($mybb->input['gesinnung']),
"gruppierung" => $db->escape_string($mybb->input['gruppierung']),
"spezies" => $db->escape_string($mybb->input['spezies']),
"geschlecht" => $db->escape_string($mybb->input['geschlecht'])
);

$plugins->run_hooks("admin_user_titles_edit_commit");

$db->update_query("bookcharas"$updated_chara"bcid='{$bookchara['bcid']}'");

$cache->update_charas();

// Log admin action
log_admin_action($bookcharas['bcid'], htmlspecialchars_uni($mybb->input['name']);

flash_message($lang->success_user_title_updated'success');
admin_redirect("index.php?module=home-bookcharas");
}
}

$page->add_breadcrumb_item($lang->edit_user_title);
$page->output_header($lang->user_titles." - ".$lang->edit_user_title);

$sub_tabs['edit_chara'] = array(
'title' => $lang->edit_user_title,
'link' => "index.php?module=home-bookcharas&amp;action=edit&amp;bcid=".$bookcharas['bcid'],
'description' => $lang->edit_user_title_desc
);

$page->output_nav_tabs($sub_tabs'edit_chara');
$form = new Form("index.php?module=home-bookcharas&amp;action=edit&amp;bcid={$bookcharas['bcid']}""post");


if(
$errors)
{
$page->output_inline_error($errors);
}
else
{
$mybb->input array_merge($mybb->input$bookcharas);
}

$form_container = new FormContainer($lang->edit_user_title);
$form_container->output_row($lang->name_to_assign."<em>*</em>"$lang->name_to_assign_desc$form->generate_text_box('name'$mybb->input['name'], array('id' => 'name')), 'name');
$select_list_status = array(
"frei" => $lang->frei,
"vergeben" => $lang->vergeben,
);
$form_container->output_row($lang->status_to_assign$lang->status_to_assign_desc$form->generate_select_box('status'$select_list_status$mybb->input['status'], array('id' => 'status')), 'status');
$form_container->output_row($lang->alter_to_assign$lang->alter_to_assign_desc$form->generate_text_box('alter'$mybb->input['alter'], array('id' => 'alter')), 'alter');
$select_list_blutstatus = array(
"reinblut" => $lang->reinblut,
"halbblut" => $lang->halbblut,
"muggelblut" => $lang->muggelblut,
);
$form_container->output_row($lang->blutstatus_to_assign$lang->blutstatus_to_assign_desc$form->generate_select_box('blutstatus'$select_list_blutstatus$mybb->input['blutstatus'], array('id' => 'blutstatus')), 'blutstatus');
$form_container->output_row($lang->beruf_to_assign$lang->beruf_to_assign_desc$form->generate_text_box('beruf'$mybb->input['beruf'], array('id' => 'beruf')), 'beruf');
$select_list_gesinnung = array(
"gut" => $lang->gut,
"boese" => $lang->boese,
"neutral" => $lang->neutral,
);
$form_container->output_row($lang->gesinnung_to_assign$lang->gesinnung_to_assign_desc$form->generate_select_box('gesinnung'$select_list_gesinnung$mybb->input['gesinnung'], 
$select_list_gruppierung 
= array(
"todesser" => $lang->todesser,
"orden" => $lang->orden,
"ohnegr" => $lang->ohnegr,
);
$form_container->output_row($lang->gruppierung_to_assign$lang->gruppierung_to_assign_desc$form->generate_select_box('gruppierung'$select_list_gruppierung$mybb->input['gruppierung'],
$select_list_spezies = array(
"zauberer" => $lang->zauberer,
"hexe" => $lang->hexe,
"muggle" => $lang->muggle,
);
$form_container->output_row($lang->spezies_to_assign$lang->spezies_to_assign_desc$form->generate_select_box('spezies'$select_list_spezies$mybb->input['spezies'],
$select_list_geschlecht = array(
"male" => $lang->male,
"female" => $lang->female,
);
$form_container->output_row($lang->geschlecht_to_assign$lang->geschlecht_to_assign_desc$form->generate_select_box('geschlecht'$select_list_geschlecht$mybb->input['geschlecht'],
$form_container->end();

$buttons[] = $form->generate_submit_button($lang->save_user_title);

$form->output_submit_wrapper($buttons);
$form->end();

$page->output_footer();

}

if(!
$mybb->input['action'])
{
$plugins->run_hooks("admin_user_titles_start");

$page->output_header($lang->manage_bookcharas);

$page->output_nav_tabs($sub_tabs'manage_titles');

$table = new Table;
$table->construct_header($lang->name, array('width' => '130''class' => 'align_center'));
$table->construct_header($lang->status, array('width' => '130''class' => 'align_center'));
$table->construct_header($lang->alter, array('width' => '130''class' => 'align_center'));
$table->construct_header($lang->blutstatus, array('width' => '130''class' => 'align_center'));
$table->construct_header($lang->beruf, array('width' => '130''class' => 'align_center'));
$table->construct_header($lang->gesinnung, array('width' => '130''class' => 'align_center'));
$table->construct_header($lang->gruppierung, array('width' => '130''class' => 'align_center'));
$table->construct_header($lang->spezies, array('width' => '130''class' => 'align_center'));
$table->construct_header($lang->geschlecht, array('width' => '130''class' => 'align_center'));
$table->construct_header($lang->controls, array("class" => "align_center""colspan" => 2"width" => 200));

$query $db->simple_select("bookcharas""*""", array('order_by' => 'name'));
while(
$bookcharas $db->fetch_array($query))

$table->construct_cell("<a href=\"index.php?module=home-bookcharas&amp;action=edit&amp;bcid={$bookcharas['bcid']}\"><strong>{$bookcharas['name']}</strong></a>");
$table->construct_cell($bookcharas['status'], array("class" => "align_center"));
$table->construct_cell($bookcharas['alter'], array("class" => "align_center"));
$table->construct_cell($bookcharas['blutstatus'], array("class" => "align_center"));
$table->construct_cell($bookcharas['beruf'], array("class" => "align_center"));
$table->construct_cell($bookcharas['gesinnung'], array("class" => "align_center"));
$table->construct_cell($bookcharas['gruppierung'], array("class" => "align_center"));
$table->construct_cell($bookcharas['spezies'], array("class" => "align_center"));
$table->construct_cell($bookcharas['geschlecht'], array("class" => "align_center"));
$table->construct_cell("<a href=\"index.php?module=home-bookcharas&amp;action=edit&amp;bcid={$bookcharas['bcid']}\">{$lang->edit}</a>", array("width" => 100"class" => "align_center"));
$table->construct_cell("<a href=\"index.php?module=home-bookcharas&amp;action=delete&amp;bcid={$bookcharas['bcid']}&amp;my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->bookchara_deletion_confirmation}')\">{$lang->delete}</a>", array("width" => 100"class" => "align_center"));
$table->construct_row();
}

if(
$table->num_rows() == 0)
{
$table->construct_cell($lang->no_bookcharas, array('colspan' => 4));
$table->construct_row();
$no_results true;
}

$table->output($lang->manage_bookcharas);

$page->output_footer();

Zitieren
#2
Wie es schon im SG Forum erwähnt wurde, muss die module_meta angepasst werden. Desweiteren fehlen deine Arrays ($select_list_........) womit eine Übergabe überhaupt erst stattfinden kann. Vollständig ist diese auch nicht, da fehlen einige Zeilen Code und und und

Sorry wenn ich es so direkt schreibe, aber deine Datei ist ziemlicher Müll.

Ziehe dir eine andere Datei im ACP zu Rate, zB diese ./modules/user/titles.php

Diese hat alle nötigen Funktionen die Du wahrscheinlich benötigst.
Mit freundlichen Grüßen

MrBrechreiz
Zitieren
#3
Zitat:Als Ausgangslage für die bookcharas.php diente mir dabei die /admin/modules/user/titles.php, die ich einfach nur kopiert und für meine Belange angepasst habe.

Wer lesen kann ist klar im Vorteil, denn deinen Vorschlag ("Ziehe dir eine andere Datei im ACP zu Rate, zB diese ./modules/user/titles.php") habe ich von Anfang an umgesetzt, vielen Dank.

Und sorry, wenn ich es so direkt schreibe, aber dein Support ist ziemlicher Müll. Mit Hilfe hat das nämlich gar nichts zu tun.
Zitieren
#4
Ohh, sorry, völlig überlesen das Du diese Datei zu Rate gezogen hattest.

Trozdem ist deine Datei Müll.

Viel Erfolg beim gelingen deines Projektes. Ich bin hier raus.
Mit freundlichen Grüßen

MrBrechreiz
Zitieren
#5
Ich hab die Datei noch mal überarbeitet und ein paar Fehler ausgebessert/fehlende Codes hinzugefügt. Würde mich freuen, wenn vielleicht doch jemand drüber schauen und mir ein paar Tipps geben kann. (:

PHP-Code:
<?php
/**
*
* Buchcharaktere
*
*/

// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
die(
"Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

$page->add_breadcrumb_item($lang->home_bookcharas"index.php?module=home-bookcharas");

if(
$mybb->input['action'] == "add" || !$mybb->input['action'])
{
$sub_tabs['manage_titles'] = array(
'title' => $lang->home_bookcharas,
'link' => "index.php?module=home-bookcharas",
'description' => $lang->home_bookcharas_desc
);
$sub_tabs['add_title'] = array(
'title' => $lang->add_new_bookchara,
'link' => "index.php?module=home-bookcharas&amp;action=add",
'description' => $lang->add_new_bookchara_desc
);
}

$plugins->run_hooks("admin_user_titles_begin");

if(
$mybb->input['action'] == "edit")
{
$query $db->simple_select("bookcharas""*""bcid='".$mybb->get_input('bcid'MyBB::INPUT_INT)."'");
$bookcharas $db->fetch_array($query);

if(!
$bookcharas['bcid'])
{
flash_message($lang->error_invalid_user_title'error');
admin_redirect("index.php?module=home-bookcharas");
}

$plugins->run_hooks("admin_user_titles_edit");

if(
$mybb->request_method == "post")
{
if(!
trim($mybb->input['name']))
{
$errors[] = $lang->error_missing_title;
}

if(!
$errors)
{
$updated_chara = array(
"name" => $db->escape_string($mybb->input['name']),
"status" => $db->escape_string($mybb->input['status']),
"alter" => $db->escape_string($mybb->input['alter']),
"blutstatus" => $db->escape_string($mybb->input['blutstatus']),
"beruf" => $db->escape_string($mybb->input['beruf']),
"gesinnung" => $db->escape_string($mybb->input['gesinnung']),
"gruppierung" => $db->escape_string($mybb->input['gruppierung']),
"spezies" => $db->escape_string($mybb->input['spezies']),
"geschlecht" => $db->escape_string($mybb->input['geschlecht'])
);

$plugins->run_hooks("admin_user_titles_edit_commit");

$db->update_query("bookcharas"$updated_chara"bcid='{$bookchara['bcid']}'");

$cache->update_charas();

// Log admin action
log_admin_action($bookcharas['bcid'], htmlspecialchars_uni($mybb->input['name']);

flash_message($lang->success_user_title_updated'success');
admin_redirect("index.php?module=home-bookcharas");
}
}

$page->add_breadcrumb_item($lang->edit_user_title);
$page->output_header($lang->user_titles." - ".$lang->edit_user_title);

$sub_tabs['edit_chara'] = array(
'title' => $lang->edit_user_title,
'link' => "index.php?module=home-bookcharas&amp;action=edit&amp;bcid=".$bookcharas['bcid'],
'description' => $lang->edit_user_title_desc
);

$page->output_nav_tabs($sub_tabs'edit_chara');
$form = new Form("index.php?module=home-bookcharas&amp;action=edit&amp;bcid={$bookcharas['bcid']}""post");


if(
$errors)
{
$page->output_inline_error($errors);
}
else
{
$mybb->input array_merge($mybb->input$bookcharas);
}

$form_container = new FormContainer($lang->edit_user_title);
$form_container->output_row($lang->name_to_assign."<em>*</em>"$lang->name_to_assign_desc$form->generate_text_box('name'$mybb->input['name'], array('id' => 'name')), 'name');
$select_list_status = array(
"frei" => $lang->frei,
"vergeben" => $lang->vergeben
);
$form_container->output_row($lang->status_to_assign$lang->status_to_assign_desc$form->generate_select_box('status'$select_list_status$mybb->input['status'], array('id' => 'status')), 'status');
$form_container->output_row($lang->alter_to_assign$lang->alter_to_assign_desc$form->generate_text_box('alter'$mybb->input['alter'], array('id' => 'alter')), 'alter');
$select_list_blutstatus = array(
"reinblut" => $lang->reinblut,
"halbblut" => $lang->halbblut,
"muggelblut" => $lang->muggelblut
);
$form_container->output_row($lang->blutstatus_to_assign$lang->blutstatus_to_assign_desc$form->generate_select_box('blutstatus'$select_list_blutstatus$mybb->input['blutstatus'], array('id' => 'blutstatus')), 'blutstatus');
$form_container->output_row($lang->beruf_to_assign$lang->beruf_to_assign_desc$form->generate_text_box('beruf'$mybb->input['beruf'], array('id' => 'beruf')), 'beruf');
$select_list_gesinnung = array(
"gut" => $lang->gut,
"boese" => $lang->boese,
"neutral" => $lang->neutral
);
$form_container->output_row($lang->gesinnung_to_assign$lang->gesinnung_to_assign_desc$form->generate_select_box('gesinnung'$select_list_gesinnung$mybb->input['gesinnung'], array('id' => 'gesinnung')), 'gesinnung'); 
$select_list_gruppierung = array(
"todesser" => $lang->todesser,
"orden" => $lang->orden,
"ohnegr" => $lang->ohnegr
);
$form_container->output_row($lang->gruppierung_to_assign$lang->gruppierung_to_assign_desc$form->generate_select_box('gruppierung'$select_list_gruppierung$mybb->input['gruppierung'], array('id' => 'gruppierung')), 'gruppierung');
$select_list_spezies = array(
"zauberer" => $lang->zauberer,
"hexe" => $lang->hexe,
"muggle" => $lang->muggle
);
$form_container->output_row($lang->spezies_to_assign$lang->spezies_to_assign_desc$form->generate_select_box('spezies'$select_list_spezies$mybb->input['spezies'], array('id' => 'spezies')), 'spezies');
$select_list_geschlecht = array(
"male" => $lang->male,
"female" => $lang->female
);
$form_container->output_row($lang->geschlecht_to_assign$lang->geschlecht_to_assign_desc$form->generate_select_box('geschlecht'$select_list_geschlecht$mybb->input['geschlecht'], array('id' => 'geschlecht')), 'geschlecht');
$form_container->end();

$buttons[] = $form->generate_submit_button($lang->save_user_title);

$form->output_submit_wrapper($buttons);
$form->end();

$page->output_footer();

}

if(!
$mybb->input['action'])
{
$plugins->run_hooks("admin_user_titles_start");

$page->output_header($lang->manage_bookcharas);

$page->output_nav_tabs($sub_tabs'manage_titles');

$table = new Table;
$table->construct_header($lang->name, array('width' => '130''class' => 'align_center'));
$table->construct_header($lang->status, array('width' => '130''class' => 'align_center'));
$table->construct_header($lang->alter, array('width' => '130''class' => 'align_center'));
$table->construct_header($lang->blutstatus, array('width' => '130''class' => 'align_center'));
$table->construct_header($lang->beruf, array('width' => '130''class' => 'align_center'));
$table->construct_header($lang->gesinnung, array('width' => '130''class' => 'align_center'));
$table->construct_header($lang->gruppierung, array('width' => '130''class' => 'align_center'));
$table->construct_header($lang->spezies, array('width' => '130''class' => 'align_center'));
$table->construct_header($lang->geschlecht, array('width' => '130''class' => 'align_center'));
$table->construct_header($lang->controls, array("class" => "align_center""colspan" => 2"width" => 200));

$query $db->simple_select("bookcharas""*""", array('order_by' => 'name'));
while(
$bookcharas $db->fetch_array($query))

$table->construct_cell("<a href=\"index.php?module=home-bookcharas&amp;action=edit&amp;bcid={$bookcharas['bcid']}\"><strong>{$bookcharas['name']}</strong></a>");
$table->construct_cell($bookcharas['status'], array("class" => "align_center"));
$table->construct_cell($bookcharas['alter'], array("class" => "align_center"));
$table->construct_cell($bookcharas['blutstatus'], array("class" => "align_center"));
$table->construct_cell($bookcharas['beruf'], array("class" => "align_center"));
$table->construct_cell($bookcharas['gesinnung'], array("class" => "align_center"));
$table->construct_cell($bookcharas['gruppierung'], array("class" => "align_center"));
$table->construct_cell($bookcharas['spezies'], array("class" => "align_center"));
$table->construct_cell($bookcharas['geschlecht'], array("class" => "align_center"));
$table->construct_cell("<a href=\"index.php?module=home-bookcharas&amp;action=edit&amp;bcid={$bookcharas['bcid']}\">{$lang->edit}</a>", array("width" => 100"class" => "align_center"));
$table->construct_cell("<a href=\"index.php?module=home-bookcharas&amp;action=delete&amp;bcid={$bookcharas['bcid']}&amp;my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->bookchara_deletion_confirmation}')\">{$lang->delete}</a>", array("width" => 100"class" => "align_center"));
$table->construct_row();
}

if(
$table->num_rows() == 0)
{
$table->construct_cell($lang->no_bookcharas, array('colspan' => 4));
$table->construct_row();
$no_results true;
}

$table->output($lang->manage_bookcharas);

$page->output_footer();

Zitieren
#6
PHP-Code:
<?php
/**
*
* Buchcharaktere
*
*/

// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
die(
"Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

$page->add_breadcrumb_item("lang->home_bookcharas""index.php?module=home-bookcharas");

if(
$mybb->input['action'] == "add" || !$mybb->input['action'])
{
    
$sub_tabs['manage_bookcharas'] = array(
        
'title' => "lang->home_bookcharas",
        
'link' => "index.php?module=home-bookcharas",
        
'description' => "lang->home_bookcharas_desc"
    
);
    
$sub_tabs['add_bookcharas'] = array(
        
'title' => "lang->add_new_bookchara",
        
'link' => "index.php?module=home-bookcharas&amp;action=add",
        
'description' => "lang->add_new_bookchara_desc"
    
);
}

$plugins->run_hooks("admin_user_bookcharas_begin");

if(
$mybb->input['action'] == "edit")
{
    
$query $db->simple_select("bookcharas""*""bcid='{$mybb->input['bcid']}'");
    
$bookcharas $db->fetch_array($query);

    if(!
$bookcharas['bcid'])
    {
        
flash_message("lang->error_invalid_user_title"'error');
        
admin_redirect("index.php?module=home-bookcharas");
    }

    
$plugins->run_hooks("admin_user_bookcharas_edit");

    
$bcid = (int)$mybb->input['bcid'];
    
    if(
$mybb->request_method == "post")
    {
        if(!
trim($mybb->input['name']))
        {
            
$errors[] = "lang->error_missing_title";
        }

        if(!
$errors)
        {
            
$updated_chara = array(
                
"name" => $db->escape_string($mybb->input['name']),
                
"status" => $db->escape_string($mybb->input['status']),
                
"alter" => $db->escape_string($mybb->input['alter']),
                
"blutstatus" => $db->escape_string($mybb->input['blutstatus']),
                
"beruf" => $db->escape_string($mybb->input['beruf']),
                
"gesinnung" => $db->escape_string($mybb->input['gesinnung']),
                
"gruppierung" => $db->escape_string($mybb->input['gruppierung']),
                
"spezies" => $db->escape_string($mybb->input['spezies']),
                
"geschlecht" => $db->escape_string($mybb->input['geschlecht'])
            );

            
$plugins->run_hooks("admin_user_bookcharas_edit_commit");

            
$db->update_query("bookcharas"$updated_chara"bcid='{$bcid}'");

            
#$cache->update_charas();

            // Log admin action
            
log_admin_action($bookcharas['bcid'], htmlspecialchars_uni($mybb->input['name']));

            
flash_message("lang->success_user_title_updated"'success');
            
admin_redirect("index.php?module=home-bookcharas");
        }
    }

    
$page->add_breadcrumb_item("lang->edit_user_title");
    
$page->output_header("lang->user_titles - lang->edit_user_title");

    
$sub_tabs['edit_chara'] = array(
        
'title' => "lang->edit_user_title",
        
'link' => "index.php?module=home-bookcharas&amp;action=edit&amp;bcid=".$bookcharas['bcid'],
        
'description' => "lang->edit_user_title_desc"
    
);

    
$page->output_nav_tabs($sub_tabs'edit_chara');
    
$form = new Form("index.php?module=home-bookcharas&amp;action=edit&amp;bcid={$bookcharas['bcid']}""post");

    if(
$errors)
    {
        
$page->output_inline_error($errors);
    }
    else
    {
        
$mybb->input array_merge($mybb->input$bookcharas);
    }

    
$form_container = new FormContainer($lang->edit_user_title);
    
$form_container->output_row("lang->name_to_assign <em>*</em>""lang->name_to_assign_desc"$form->generate_text_box('name'$mybb->input['name'], array('id' => 'name')), 'name');
    
    
$select_list_status = array(
        
"frei" => "lang->frei",
        
"vergeben" => "lang->vergeben"
    
);
    
$form_container->output_row("lang->status_to_assign""lang->status_to_assign_desc"$form->generate_select_box('status'$select_list_status$mybb->input['status'], array('id' => 'status')), 'status');
    
    
$form_container->output_row("lang->alter_to_assign""lang->alter_to_assign_desc"$form->generate_text_box('alter'$mybb->input['alter'], array('id' => 'alter')), 'alter');
    
    
$select_list_blutstatus = array(
        
"reinblut" => "lang->reinblut",
        
"halbblut" => "lang->halbblut",
        
"muggelblut" => "lang->muggelblut"
    
);
    
$form_container->output_row("lang->blutstatus_to_assign""lang->blutstatus_to_assign_desc"$form->generate_select_box('blutstatus'$select_list_blutstatus$mybb->input['blutstatus'], array('id' => 'blutstatus')), 'blutstatus');
    
    
$form_container->output_row("lang->beruf_to_assign""lang->beruf_to_assign_desc"$form->generate_text_box('beruf'$mybb->input['beruf'], array('id' => 'beruf')), 'beruf');
    
    
$select_list_gesinnung = array(
        
"gut" => "lang->gut",
        
"boese" => "lang->boese",
        
"neutral" => "lang->neutral"
    
);
    
$form_container->output_row("lang->gesinnung_to_assign""lang->gesinnung_to_assign_desc"$form->generate_select_box('gesinnung'$select_list_gesinnung$mybb->input['gesinnung'], array('id' => 'gesinnung')), 'gesinnung');
    
    
$select_list_gruppierung = array(
        
"todesser" => "lang->todesser",
        
"orden" => "lang->orden",
        
"ohnegr" => "lang->ohnegr"
    
);
    
$form_container->output_row("lang->gruppierung_to_assign""lang->gruppierung_to_assign_desc"$form->generate_select_box('gruppierung'$select_list_gruppierung$mybb->input['gruppierung'], array('id' => 'gruppierung')), 'gruppierung');
    
    
$select_list_spezies = array(
        
"zauberer" => "lang->zauberer",
        
"hexe" => "lang->hexe",
        
"muggle" => "lang->muggle"
    
);
    
$form_container->output_row("lang->spezies_to_assign""lang->spezies_to_assign_desc"$form->generate_select_box('spezies'$select_list_spezies$mybb->input['spezies'], array('id' => 'spezies')), 'spezies');
    
    
$select_list_geschlecht = array(
        
"male" => "lang->male",
        
"female" => "lang->female"
    
);
    
$form_container->output_row("lang->geschlecht_to_assign""lang->geschlecht_to_assign_desc"$form->generate_select_box('geschlecht'$select_list_geschlecht$mybb->input['geschlecht'], array('id' => 'geschlecht')), 'geschlecht');
    
    
$form_container->end();

    
$buttons[] = $form->generate_submit_button("lang->save_user_title");

    
$form->output_submit_wrapper($buttons);
    
$form->end();

    
$page->output_footer();

}

if(!
$mybb->input['action'])
{
    
$plugins->run_hooks("admin_user_bookcharas_start");

    
$page->output_header("lang->manage_bookcharas");

    
$page->output_nav_tabs($sub_tabs'manage_bookcharas');

    
$table = new Table;
    
$table->construct_header("lang->name", array('width' => '130''class' => 'align_center'));
    
$table->construct_header("lang->status", array('width' => '130''class' => 'align_center'));
    
$table->construct_header("lang->alter", array('width' => '130''class' => 'align_center'));
    
$table->construct_header("lang->blutstatus", array('width' => '130''class' => 'align_center'));
    
$table->construct_header("lang->beruf", array('width' => '130''class' => 'align_center'));
    
$table->construct_header("lang->gesinnung", array('width' => '130''class' => 'align_center'));
    
$table->construct_header("lang->gruppierung", array('width' => '130''class' => 'align_center'));
    
$table->construct_header("lang->spezies", array('width' => '130''class' => 'align_center'));
    
$table->construct_header("lang->geschlecht", array('width' => '130''class' => 'align_center'));
    
$table->construct_header("lang->controls", array("class" => "align_center""colspan" => 2"width" => 200));

    
$query $db->simple_select("bookcharas""*""", array('order_by' => 'name'));
    while(
$bookcharas $db->fetch_array($query))
    { 
        
$table->construct_cell("<a href=\"index.php?module=home-bookcharas&amp;action=edit&amp;bcid={$bookcharas['bcid']}\"><strong>{$bookcharas['name']}</strong></a>");
        
$table->construct_cell($bookcharas['status'], array("class" => "align_center"));
        
$table->construct_cell($bookcharas['alter'], array("class" => "align_center"));
        
$table->construct_cell($bookcharas['blutstatus'], array("class" => "align_center"));
        
$table->construct_cell($bookcharas['beruf'], array("class" => "align_center"));
        
$table->construct_cell($bookcharas['gesinnung'], array("class" => "align_center"));
        
$table->construct_cell($bookcharas['gruppierung'], array("class" => "align_center"));
        
$table->construct_cell($bookcharas['spezies'], array("class" => "align_center"));
        
$table->construct_cell($bookcharas['geschlecht'], array("class" => "align_center"));
        
$table->construct_cell("<a href=\"index.php?module=home-bookcharas&amp;action=edit&amp;bcid={$bookcharas['bcid']}\">{$lang->edit}</a>", array("width" => 100"class" => "align_center"));
        
$table->construct_cell("<a href=\"index.php?module=home-bookcharas&amp;action=delete&amp;bcid={$bookcharas['bcid']}&amp;my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, 'lang->bookchara_deletion_confirmation')\">lang->delete</a>", array("width" => 100"class" => "align_center"));
        
$table->construct_row();
    }

    if(
$table->num_rows() == 0)
    {
        
$table->construct_cell($lang->no_bookcharas, array('colspan' => 4));
        
$table->construct_row();
        
$no_results true;
    }

    
$table->output("lang->manage_bookcharas");

    
$page->output_footer();


Anpassen muss Du nur wieder die lang-> Ausgaben, denn die habe ich mit "" eingegrenzt, um überhaupt etwas lesen zu können.

Deine ADD Funktion musst Du aber selbst noch anlegen.
Mit freundlichen Grüßen

MrBrechreiz
Zitieren