<?PHP
/* $Id: smenu.php,v 1.7 2003/12/01 18:15:42 k-fish Exp $ */
// ===========================================================================
// Moregroupware - Submenu Definition File (smenu.php)
// ---------------------------------------------------------------------------
// You can define your standard submenu for actual module
// by placing this file into the module folder
// if you want to override this submenu in one of your module
// programs, just define "$myEnv[stdsmenu]==false;" before the includes
// in your script and define the different submenu in your script
// ---------------------------------------------------------------------------
// Usage:
// each Entry consists of two lines:
//		$smenu[x][name] AND $smenu[x][link]
//		x is the number which you must increment per submenu item
//
//		"name" should be a key in your translation in your module language files
//		NOTE: the keys are allways in a hashmap called $hashmap[]
//
//		"link" should be the script you want to call when user hit submenu item
//		NOTE: session-id will be inserted automaticly
//
//		Important: after all just append the line "createSubmenu($smenu);" to the end
//
//		so if you want to have a submenu with 2 items, just do:
// 			$smenu[0][name] = Lang::getLanguageString("KeyA_in_your_lang_file");
//			$smenu[0][link] = ROOTURL."modules/YOURMODULE/scriptA.php?".SID;
//			$smenu[1][name] = Lang::getLanguageString("KeyB_in_your_lang_file");
//			$smenu[1][link] = ROOTURL."modules/YOURMODULE/scriptB.php?".SID;
//			createSubmenu($smenu);
$o=0;
$smenu[$o]["name"] = Lang::getLanguageString("current_news");
$smenu[$o++]["link"] = ROOTURL."modules/news/index.php?action=list_current&".SID; 

$smenu[$o]["name"] = Lang::getLanguageString("archived_news");
$smenu[$o++]["link"] = ROOTURL."modules/news/index.php?action=list_archive&".SID; 

if(queryRights2_bool("root_modules_news_write")){
    $numchan = $conn->GetRow('SELECT COUNT(id) AS numchan FROM mgw_news_channels');
	$nbchan_to_delete = ((isset($_GET['action']) && $_GET['action'] == "delete") || (isset($_POST['action']) && $_POST['action'] == "delete")) && isset($_POST['confirmation_yes']) ? 1 : 0;	
    if( ((int)$numchan['numchan']-$nbchan_to_delete) > 0 || ( isset($_POST["numchan"]) && (int)$_POST["numchan"]>0)){
	$smenu[$o]["name"] = Lang::getLanguageString("newnews");
	$smenu[$o++]["link"] = ROOTURL."modules/news/index.php?action=newform&".SID; 
    }
	
	$smenu[$o++]["name"] = "empty";
    
	$smenu[$o]["name"] = Lang::getLanguageString("newchannel");
    $smenu[$o++]["link"] = ROOTURL."modules/news/channels.php?action=newform&".SID; 
}
else {
	$smenu[$o++]["name"] = "empty";
}
if(queryRights2_bool("root_modules_news_write")||
   queryRights2_bool("root_modules_news_modify")||
   queryRights2_bool("root_modules_news_delete")){
    $smenu[$o]["name"] = Lang::getLanguageString("channelmanage");
    $smenu[$o++]["link"] = ROOTURL."modules/news/channels.php?".SID; 
}
createSubmenu($smenu);
?>