<?php
$plugins->add_hook("admin_load", "prueba_admin");
$plugins->add_hook("admin_config_menu", "prueba_admin_nav");
$plugins->add_hook("admin_config_action_handler", "prueba_action_handler");
function prueba_info()
{
return array(
"name" => "prueba",
"description" => "",
"website" => "",
"author" => "Edson Ordaz",
"authorsite" => "",
"version" => "1.0"
);
}
// This function runs when the plugin is activated.
function prueba_activate()
{
global $db;
$tables = "CREATE TABLE `".TABLE_PREFIX."prueba` (
`numero` int(10) NOT NULL,
PRIMARY KEY (`numero`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=18 ;";
$db->write_query($tables);
rebuild_settings();
}
// This function runs when the plugin is deactivated.
function prueba_deactivate()
{
global $mybb, $db, $cache;
$db->write_query('DROP TABLE `'.TABLE_PREFIX.'prueba`');
rebuild_settings();
}
function prueba_action_handler(&$action)
{
$action['prueba'] = array('active' => 'prueba', 'file' => '');
}
function prueba_admin_nav(&$sub_menu)
{
global $mybb;
end($sub_menu);
$key = (key($sub_menu))+10;
if(!$key)
{
$key = '110';
}
$sub_menu[$key] = array('id' => 'prueba', 'title' => "edson ordaz", 'link' => "index.php?module=config-prueba");
}
function prueba_admin()
{
global $mybb, $db, $page, $lang, $cache;
if($page->active_action != "prueba")
{
return;
}
$page->add_breadcrumb_item("prueba");
$page->output_header("prueba");
if($mybb->input['action'] == "save") {
$numero = array(
"numero" => $db->escape_string($mybb->input['numero'])
);
$db->update_query("prueba", $numero);
flash_message("guardado", 'success');
admin_redirect("index.php?module=config-prueba");
}
$form = new Form("index.php?module=config-prueba&action=save", "post");
$form_container = new FormContainer("prueba");
$form_container->output_row("prueba", "prueba", $form->generate_text_box('numero'), 'numero');
$form_container->end();
$buttons[] = $form->generate_submit_button("guadar");
$form->output_submit_wrapper($buttons);
$form->end();
$page->output_footer();
}
?>