<?php
/***********************************************************************************/
/* MassCRM客户关系管理系统							   */
/* ========================      						   */
/* 欢迎使用 MassCRM ,在您开始使用之前,请务必完整阅读本软件附带的全部说明档	   */
/***********************************************************************************/
/* Welcome to http://www.massboxes.com & http://masscrm.massboxes.com		   */
/***********************************************************************************/
		/*                                                      */
		/*		Boxes Easy CRM	更新功能模块的函数				*/
		/*					  作者:阿标							*/
		/*					QQ:190885451						*/
		/*			  Email:biaoest@hotmail.com					*/
		/*			    最后更新: 2005.10.10						*/
	

	
	//连接数据库
	include "../account/boxes_easy_crm.boxes.inc.php";
	//包含adodb.inc.php
	require_once('../adodb/adodb.inc.php');
	//mysql数据库
	$conn = &ADONewConnection('mysql');
	
	//显示debug过程
	$conn->debug=true;
	
	
	//连接数据库
	$conn->PConnect($MYSQL_HOSTNAME, $MYSQL_USERNAME, $MYSQL_PASSWORD, $DATABASE);
	
	require_once '../includes/BiaoCommon.class.php';
	
	$boxesDB=new BiaoCommon($conn); 
	
	//功能
	$function_array[]=array("bf_name"		=>	"列表",
							"bf_ename"		=>	"LIST");
	$function_array[]=array("bf_name"		=>	"查看",
							"bf_ename"		=>	"READ");
	$function_array[]=array("bf_name"		=>	"增加",
							"bf_ename"		=>	"ADD");
	$function_array[]=array("bf_name"		=>	"修改",
							"bf_ename"		=>	"UPDATE");
	$function_array[]=array("bf_name"		=>	"删除",
							"bf_ename"		=>	"DELETE");
	$function_array[]=array("bf_name"		=>	"打印",
							"bf_ename"		=>	"PRINT");
	$function_array[]=array("bf_name"		=>	"导出",
							"bf_ename"		=>	"EXPORT");	
	$function_array[]=array("bf_name"		=>	"导入",
							"bf_ename"		=>	"IMPORT");						
	$function_array[]=array("bf_name"		=>	"设置",
							"bf_ename"		=>	"CUSTOMIZE");
	
	//查找模块
	$boxesDB->setTableName("boxes_module");
	$sql="where bm_level!=0";
	$boxesDB->setCondition($sql);
	$boxes_module=$boxesDB->selectResult();
	
	for($i=0;$i<count($boxes_module);$i++){
		$row=$boxes_module[$i];
		for($j=0;$j<count($function_array);$j++){
			$boxesDB->setTableName("boxes_function");
			$boxesDB->setInsertArray("bf_name",$function_array[$j][bf_name]);
			$boxesDB->setInsertArray("bf_ename",$function_array[$j][bf_ename]);
			$boxesDB->setInsertArray("bf_module_num",$row[bm_auto_id]);
			$boxesDB->setInsertArray("bf_module",$row[bm_name]);
			$boxes_result=$boxesDB->insertRow();
		}		
	}


?>