makeTboxData4Save($title);
$link = $myts->makeTboxData4Save($link);
$groups = (is_array($groups)) ? implode(" ", $groups) : '';
$db = $xoopsDB->prefix( "multimenu".$menu_num );
if ( empty($id) ) {
$newid = $xoopsDB->genId($db."_id_seq");
$success = $xoopsDB->query("INSERT INTO ".$db." (id,title,hide,link,weight,groups,target) VALUES ($newid,'$title','$hide','$link','255','$groups','$target')");
im_admin_clean($menu_num);
} else {
$success = $xoopsDB->query("UPDATE ".$db." SET title='$title', hide='$hide', link='$link', groups='$groups', target='$target' WHERE id='$id'");
}
if ( !$success ) {
redirect_header("index".$menu_num.".php",2,_AD_MULTIMENU_UPDATED);
}else {
redirect_header("index".$menu_num.".php",2,_AD_MULTIMENU_UPDATED);
}
exit();
}
function im_admin_edit ($menu_num, $id) {
global $xoopsDB;
xoops_cp_header();
mm_admin_menu(intval($menu_num), _AD_MULTIMENU_ADMIN.$menu_num );
echo "
";
xoops_cp_footer();
}
function im_admin_del ($menu_num, $id, $del=0) {
global $xoopsDB;
$xoopsDB =& Database::getInstance();
$db = $xoopsDB->prefix( "multimenu".$menu_num );
if ( $del == 1 ) {
if ( $xoopsDB->query("DELETE FROM ".$db." WHERE id=$id") ) {
im_admin_clean($menu_num);
redirect_header("index".$menu_num.".php", 2, _AD_MULTIMENU_UPDATED);
} else {
redirect_header("index".$menu_num.".php", 2, _AD_MULTIMENU_NOTUPDATED);
}
exit();
} else {
xoops_cp_header();
echo ""._AD_MULTIMENU_ADMIN.$menu_num."
";
xoops_confirm(array('op' => 'del', 'id' => $id, 'del' => 1), 'index'.$menu_num.'.php', _AD_MULTIMENU_SUREDELETE);
xoops_cp_footer();
}
}
function im_admin_move ($menu_num, $id, $weight) {
global $xoopsDB;
$xoopsDB =& Database::getInstance();
$db = $xoopsDB->prefix( "multimenu".$menu_num );
$xoopsDB->queryF("UPDATE ".$db." SET weight=weight+1 WHERE weight>=$weight AND id<>$id");
$xoopsDB->queryF("UPDATE ".$db." SET weight=$weight WHERE id=$id");
im_admin_clean($menu_num);
}
function im_admin_new($menu_num) {
global $xoopsDB;
xoops_cp_header();
mm_admin_menu(intval($menu_num), _AD_MULTIMENU_ADMIN.$menu_num );
echo "
";
xoops_cp_footer();
}
function im_admin_list($menu_num) {
global $xoopsDB;
xoops_cp_header();
mm_admin_menu(intval($menu_num), _AD_MULTIMENU_ADMIN.$menu_num );
echo "
";
xoops_cp_footer();
}
function im_admin_clean($menu_num) {
global $xoopsDB;
$i=0;
$db = $xoopsDB->prefix( "multimenu".$menu_num );
$result = $xoopsDB->query("SELECT id FROM ".$db." ORDER BY weight ASC");
while (list($id) = $xoopsDB->fetchrow($result)) {
$xoopsDB->queryF("UPDATE ".$db." SET weight='$i' WHERE id=$id");
$i++;
}
}
function mm_admin_menu($currentoption=0, $breadcrumb="")
{
global $xoopsModule, $xoopsConfig;
$tblColors=Array();
$tblColors[0] = $tblColors[1] = $tblColors[2] = $tblColors[3] = $tblColors[4] = $tblColors[5] = $tblColors[6] = $tblColors[7] = $tblColors[8] = '#DDE';
$tblColors[$currentoption] = 'white';
$language = $xoopsConfig['language'] ;
if( ! file_exists( XOOPS_ROOT_PATH . '/modules/system/language/'.$language.'/admin/blocksadmin.php') ) $language = 'english' ;
include_once( XOOPS_ROOT_PATH . '/modules/system/language/'.$language.'/admin.php' ) ;
include_once( XOOPS_ROOT_PATH . '/modules/system/language/'.$language.'/admin/blocksadmin.php' ) ;
echo "
".$xoopsModule->name()." : ".$breadcrumb."
|
";
echo "";
echo "";
echo "
";
}
?>