HRMS文件解析2

时间:2024-08-09 23:04:26

returntablefieldColorFilterGray()函数在/lib/select_menu.php文件中,函数如下:

 function returntablefieldColorFilterGray($tablename,$what,$value,$return,$groupfield='',$groupvalue='',$字段名称='',$hascolor=false)        { // 仅用于TABLEFILTERCOLOR函数

     /*
global $return_sql_line;
$where_sql = $return_sql_line['where_sql'];;
$where_sql_array = explode("where",$where_sql);
if(trim($where_sql_array[1])!=""&&$字段名称!="") {
$ADD_SQL_WHERE_TEXT = " and $return in (select distinct $字段名称 $where_sql)";
}
else {
$ADD_SQL_WHERE_TEXT = "";
}
*/
global $db;
if($value=='')
return;
if($groupfield!=""&&$groupvalue!="") {
$sql = "select $return,$what from $tablename where $what='$value' and $groupfield='$groupvalue' $ADD_SQL_WHERE_TEXT";
$TEMP_TAR = 1;
}
else {
$sql = "select $return,$what from $tablename where $what='$value' $ADD_SQL_WHERE_TEXT"; // select DEPT_NAME,DEPT_NAME from department where DEPT_NAME='网络与数据中心'
$TEMP_TAR = 0;
} $return2 = '';
$rs=$db->CacheExecute(15,$sql); $rs_a = $rs->GetArray(); if(sizeof($rs_a)==0 || $rs_a[0][$return]=="") { // 是否有返回值
$return2 = "<font color=gray title='在".$tablename."表关联信息中,找不到与本值对应的信息.'>$value</font>"; // 没有返回值,这个值颜色变灰色
}
else
{ //有返回值,进行着色处理 $cutvalue=cutStr($rs_a[0][$return],13);
$tip='';
if($rs_a[0][$return]!=$cutvalue)
{
$tip="title='".$rs_a[0][$return]."'";
$rs_a[0][$return]=$cutvalue."..";
} $colorValue = setColorByName($value); //根据 汉族 这个词语,进行涂色,函数定义也在select_menu.php中
if($value=="是")
$colorValue="green";
else if($value=="否")
$colorValue="red";
//print "".strval($value)."";exit;
//print_r($rs_a);exit; if($tablename == 'customer'){ $id = $rs_a[0][$what]; $return2 = "<a target='_blank' $tip href='../JXC/customer_newai.php?".base64_encode("action=view_default&ROWID=".$id)."'><font color=$colorValue>".$rs_a[0][$return]."</font></a>";
}elseif($tablename == 'supply'){ $id = $rs_a[0][$what]; $return2 = "<a target='_blank' $tip href='../JXC/supply_newai.php?".base64_encode("action=view_default&ROWID=".$id)."'><font color=$colorValue>".$rs_a[0][$return]."</font></a>"; }elseif($tablename == 'linkman'){
//$id = isset($rs_a[0]['ROWID'])?$rs_a[0]['ROWID']:$value; if(isset($rs_a[0]['ROWID'])){
$id = $rs_a[0]['ROWID'];
$qq=returntablefield("linkman", "rowid", $id, "fax"); $return2 = "<a target='_blank' $tip href='../JXC/linkman_newai.php?".base64_encode("action=view_default&ROWID=".$id)."'><font color=$colorValue>".$rs_a[0][$return]."</font></a>";
}
else
$return2=$rs_a[0][$return];
}elseif($tablename == 'supplylinkman'){
//$id = isset($rs_a[0]['ROWID'])?$rs_a[0]['ROWID']:$value;
if(isset($rs_a[0]['ROWID'])){
$id = $rs_a[0]['ROWID'];
}else{
$sql = "select ROWID from $tablename where supplyname='".$value."'";
$rowid_rs=$db->CacheExecute(15,$sql);
$rowid = $rowid_rs->GetArray();
$id = $rowid[0]['ROWID'];
}
$return2 = "<a target='_blank' $tip href='../JXC/supplylinkman_newai.php?".base64_encode("action=view_default&ROWID=".$id)."'><font color=$colorValue>".$rs_a[0][$return]."</font></a>"; }elseif($tablename == 'user'){
if(isset($rs_a[0]['ROWID'])){
$id = $rs_a[0]['ROWID'];
}else{
$sql = "select UID from $tablename where USER_ID='".$value."'";
$rowid_rs=$db->CacheExecute(15,$sql);
$rowid = $rowid_rs->GetArray();
$id = $rowid[0]['UID'];
}
$return2 = "<a target='_blank' $tip href='../Framework/user_newai.php?".base64_encode("action=view_default&UID=".$id)."'><font color=$colorValue>".$rs_a[0][$return]."</font></a>"; }elseif($tablename == 'crm_chance'){
if(isset($rs_a[0]['编号'])){
$id = $rs_a[0]['编号'];
}else{
$sql = "select 编号 from $tablename where 机会主题='".$value."'";
$rowid_rs=$db->CacheExecute(15,$sql);
$rowid = $rowid_rs->GetArray();
$id = $rowid[0]['编号'];
}
$return2 = "<a target='_blank' $tip href='../JXC/crm_chance_newai.php?".base64_encode("action=view_default&编号=".$id)."'><font color=$colorValue>".$rs_a[0][$return]."</font></a>"; }
elseif($tablename == 'product'){ $return2 = "<a target='_blank' $tip href='../JXC/product_newai.php?".base64_encode("action=view_default&productid=".$value)."'><font color=$colorValue>".$rs_a[0][$return]."</font></a>"; }
elseif($tablename == 'sellplanmain'){ $id = $rs_a[0]['billid']; $billtype=returntablefield($tablename, "billid", $id, "billtype"); if($billtype==1)
$urlName="sellcontract";
else if($billtype==2)
$urlName="sellplanmain";
else if($billtype==3)
$urlName="sellonemain";
$return2 = "<a target='_blank' $tip href='../JXC/".$urlName."_newai.php?".base64_encode("action=view_default&billid=".$id)."'><font color=$colorValue>".$rs_a[0][$return]."</font></a>"; }
elseif($tablename == 'buyplanmain'){ $id = $rs_a[0]['billid']; $return2 = "<a target='_blank' $tip href='../JXC/buyplanmain_newai.php?".base64_encode("action=view_default&billid=".$id)."'><font color=$colorValue>".$rs_a[0][$return]."</font></a>"; }
elseif($tablename == 'stock'){ $id = $rs_a[0]['ROWID'];
$return2 = "<a target='_blank' $tip href='../JXC/store_product_newai.php?".base64_encode("action=init_default&storeid=".$id)."'><font color=$colorValue>".$rs_a[0][$return]."</font></a>"; }
elseif($tablename == 'bank'){ $id = $rs_a[0][$what];
$return2 = "<a target='_blank' $tip href='../JXC/v_accessbank_newai.php?".base64_encode("action=init_default&银行账户=".$id)."'><font color=$colorValue>".$rs_a[0][$return]."</font></a>"; }
elseif($tablename == 'fahuotype'){ $id = $rs_a[0]['id'];
$return2 = "<a target='_blank' $tip href='../JXC/fahuodan_newai.php?".base64_encode("action=init_default&fahuotype=".$id)."'><font color=$colorValue>".$rs_a[0][$return]."</font></a>"; }
elseif($tablename == 'customerproduct'){ $id = $rs_a[0]['ROWID'];
$return2 = "<a target='_blank' $tip href='../JXC/customerproduct_newai.php?".base64_encode("action=view_default&ROWID=".$id)."'><font color=$colorValue>".$rs_a[0][$return]."</font></a>"; }
elseif($tablename == 'customer_xuqiu'){ $id = $rs_a[0][$what];
$return2 = "<a target='_blank' $tip href='../JXC/customer_xuqiu_newai.php?".base64_encode("action=view_default&$what=".$id)."'><font color=$colorValue>".$rs_a[0][$return]."</font></a>"; }
elseif($tablename == 'crm_shenqingbaobei'){ $id = $rs_a[0][$what];
$return2 = "<a target='_blank' $tip href='../JXC/crm_shenqingbaobei_newai.php?".base64_encode("action=view_default&$what=".$id)."'><font color=$colorValue>".$rs_a[0][$return]."</font></a>"; }
elseif($tablename == 'workplanmain'){ $id = $rs_a[0][$what];
$return2 = "<a target='_blank' $tip href='../CRM/workplanmain_newai.php?".base64_encode("action=view_default&$what=".$id)."'><font color=$colorValue>".$rs_a[0][$return]."</font></a>"; }
else{ if($hascolor)
$return2 = "<span $tip><font color=$colorValue>".$rs_a[0][$return]."</font></span>";
else
$return2 ="<span $tip>".$rs_a[0][$return]."</span>";
}
} //print $return2;print $value;print "<BR>";
//if($value=="50001") exit;
//print $return2;exit;
//if($TEMP_TAR == 1) print_R($return2);
return $return2;
}

print_search_element_array()在html_element.php文件中,函数如下:

 function print_search_element_array($name,$value,$mark='default',$affixation=array(),$affixation_index)    {
global $common_html,$db,$action_model,$action_search,$location_title;
global $read_type,$email_filter,$sms_filter,$_GET,$html_etc,$tablename;
global $primarykey_index;
global $fields;
$action="init_".$mark."_search"; // init_default_search
if(isset($action_search)) {
form_begin('Form2',"$action",'get'); // 执行,也在html_element.php文件中,见下
print "<THEAD >\n"; // table的表头,建立了一个空的表头
print "<TR>";
print "<TD noWrap colspan=".$fields['table']['colspan'].">\n";
// 不换行 65 列
print "<table width=100% class=Small border=0><THEAD ><tr ><td noWrap>"; if(isset($action_model)) // ini文件中存在$action_model
show_new_element($action_model,$location_title); // 设置3个按键
//print $common_html['common_html']['search'].":\n";
$addtext=$affixation[0]['index_name'];
//print_R($affixation);&&$_GET['actionadv']==''
//当高级搜索打开时,此部分不进行显示,高级搜索关闭时,此部分显示
if($_GET['actionadv']=='') {
print "<input type=hidden name=action value=$action>";
// print "<input type=hidden name='".$addtext."' value='".$_GET[$addtext]."'>"; print "<select class=\"SmallSelect\" name=\"searchfield\" onkeydown=\"if(event.keyCode==13)event.keyCode=9\" >\n"; //当GETSEARCHFIELD不为空时,进行SESSION注册操作
if($_GET['searchfield']!="") {
//session_register("SYSTEM_INITVIEW_SEARCH_LIST_DEFAULT");
$_SESSION['SYSTEM_INITVIEW_SEARCH_LIST_DEFAULT'] = $_GET['searchfield'];
//session_register("SYSTEM_INITVIEW_SEARCH_VALUE_DEFAULT");
$_SESSION['SYSTEM_INITVIEW_SEARCH_VALUE_DEFAULT'] = $_GET['searchvalue'];
} for($i=0;$i<sizeof($name);$i++) { // 35个option逐项添加
if($_SESSION['SYSTEM_INITVIEW_SEARCH_LIST_DEFAULT']==$value[$i]) {
$temp = "selected";
}
else
$temp = "";
print "<option value=\"".$value[$i]."\" $temp>".$name[$i]."</option>\n";
} print "</select>\n";
print "<INPUT type=\"text\" class=\"SmallInput\" maxLength=200 size=\"12\" name=\"searchvalue\" value=\"".$_SESSION['SYSTEM_INITVIEW_SEARCH_VALUE_DEFAULT']."\">\n"; // 添加一个输入文本框
print "<INPUT class=SmallButton title=\"".$common_html['common_html']['accesskey'].":ALT+F\"\" type=submit accesskey=\"f\" value=\"".$common_html['common_html']['search']."\" name=button>\n"; // 添加一个submit按钮 }//高级搜索部分判断结束 //print_R($affixation);
global $SYTEM_CONFIG_TABLE;
$SYTEM_CONFIG_TABLE!=""?$tablename=$SYTEM_CONFIG_TABLE:'';
if(is_array($affixation)&&sizeof($affixation)>0) {
foreach($affixation as $list) { // 附加的搜索项
switch($list['attribute']) {
case 'text':
print "<select class=\"SmallSelect\" >\n";
print "<option value=\"\" >".$affixation_index."</option>\n";
print "</select>\n";
break;
case 'hidden':
break;
case 'fixed':
break;
default:
//$return=returnpageaction($mode='group_filter',array('index_name'=>$list['index_name'],'index_id'=>''));
//print $_GET['DEPT_ID_NAME'];;
$FormPageAction=FormPageAction2("action",$_GET[action],'','',$list['index_name']); // pageid=1&action=init_default
//print "<font color=black>".$html_etc[$tablename][$list['index_name']].":</font>&nbsp;";
print "<select class=\"SmallSelect\" onChange=\"var jmpURL='?".$FormPageAction."&".$list['index_name']."=' + this.options[this.selectedIndex].value ; if(jmpURL!='') {window.location=jmpURL;} else {this.selectedIndex=0 ;}\" name=\"".$list['index_name']."\" >\n"; // select的option发生变化,jmpURL变量可能为pageid=1&action=init_default&所属部门=业务一部,name值为 业务一部,window.location为向本页传递参数。
//print "<option value=\"\" >".$common_html['common_html']['allrecords']."</option>\n";
print "<option value=\"\" >".$html_etc[$tablename][$list['index_name']]."[".$common_html['common_html']['allrecords']."]</option>\n"; // $tablename为hrms_file,$list['index_name']为 所属部门,然后 [全部记录] 第一个默认option
// 下面是附加域group_filter的option
for($i=0;$i<sizeof($list['fieldid']);$i++) { print "<option value=\"".$list['fieldid'][$i]."\" ".$list['selected'][$i].">".$list['fieldname'][$i]."</option>\n";
}
print "</select>\n";
}//end switch
}//end foreach
}//end if if($email_filter!="")
$temp=$email_filter;
else if($sms_filter!='')
$temp=$sms_filter;
else $temp=''; if($temp) {
$array_filter=explode(',',$temp);
if($_GET['action']=='init_default') {
$_GET['action']=='init_inbox';
}
print "<select class=\"SmallSelect\" onChange=\"var jmpURL=this.options[this.selectedIndex].value ; if(jmpURL!='') {window.location=jmpURL;} else {this.selectedIndex=0 ;}\" name=\"".$list['index_name']."_NAME\" >\n";
for($i=0;$i<sizeof($array_filter);$i++) {
if("init_".$array_filter[$i]==$_GET['action']) $selected='selected';
else $selected='';
print "<option value=\"?action=init_".$array_filter[$i]."\" $selected>".$common_html['common_html'][(String)$array_filter[$i]]."</option>\n";
}
print "</select>\n";
} global $增加对查询日期快捷方式的支持_是否启用;
if($增加对查询日期快捷方式的支持_是否启用==1&&$_SESSION['增加对查询日期快捷方式的支持']=='设置为0') {
print "&nbsp;&nbsp;<a href='?".FormPageAction("增加对查询日期快捷方式的支持GET","设置为1")."'><font color=gray title=\"启用'增加对查询日期快捷方式的支持'功能\">打开查询日期显示</font></a>";
}
//提示信息显示
print "</td>\n";
print "<td nowrap width=60%><DIV class=InputError id=Searchvalue_CSS></DIV></td>\n";
print "</tr></THEAD></table>"; print "</TD></TR>\n";
print "</THEAD>\n";
form_end(); // form表单结束 //###############################################################################
//###############################################################################
//###############################################################################
global $USER_DEFINE_FUNCTION_PAGE_NAME;
if($USER_DEFINE_FUNCTION_PAGE_NAME!= "") {
$USER_DEFINE_FUNCTION_PAGE_NAME();
} }
}

form_begin()函数在文件html_element.php中,函数如下:

 function form_begin($name="form1",$action="init",$method="post",$infor='')    {
if(is_array($infor)) {
formcheck($name,$infor);
print "<FORM name=$name id=form onsubmit=\"return FormCheck();\" \n action=\"$PHP_SELF?$action&pageid=".$_GET['pageid']."\" method=$method encType=multipart/form-data>\n";
}
else { // 执行 action中$PHP_SELF为自身,就是action动作发生变化,$name=form2,$action = init_default_search,$method = get
print "<FORM name=$name id=form action=\"$PHP_SELF?$action&pageid=".$_GET['pageid']."\" method=$method encType=multipart/form-data>\n";
}
print "<input type=hidden name='userdefine' value=''>";
}

show_new_element()函数在html_element.php中,函数如下:

 function show_new_element($action_model,$location_title='')        {
global $common_html,$action_model,$_GET,$tablename;
global $group_user,$_SESSION;
//权限体系分配;
$USER_PRIV_ID = $_SESSION['SUNSHINE_USER_PRIV']; //null
$USER_PRIV = returntablefield("user_priv","USER_PRIV",$USER_PRIV_ID,"PRIV_Name"); //null $action_model_array=explode(',',$action_model); // array(3)
for($i=0;$i<sizeof($action_model_array);$i++) {
$model_index_array=explode(':',$action_model_array[$i]);
$index_mid=$model_index_array[0];
$index=$model_index_array[1];
if($index=='export' && $_SESSION['LOGIN_USER_PRIV']==3)
continue;
if($index=='') {
$index_array=explode('_',$index_mid);
$index=$index_array[0];
} //得到系统文件分配权限
$USER_PRIV_USER = $model_index_array[3];
if($USER_PRIV_USER==""||($USER_PRIV_USER==$USER_PRIV||$USER_PRIV=='1'||$USER_PRIV=='2')) {
switch($index) { //第一个是new,到default
case 'set':
//$url="?action=".$index_mid."&table_name=$tablename&table_action=".$_GET['action'];
$actionValue=explode("_",$_GET['action']);
$actionValueText="";
for($m=1;$m<sizeof($actionValue);$m++) {
$actionValueText.="_".$actionValue[$m];
}
$actionValueText="set".$actionValueText;
$return=FormPageAction("action",$actionValueText,"table_name",$tablename,'',"table_action",$_GET['action'],"returnmodel",$_GET['action']);
$url="?".$url;
break;
case 'setlang':
$url="systemlang.php?action=init_default&tablename=$tablename";
break;
case 'exportadv':
$return=FormPageAction("actionadv",$index_mid);
//$return=returnpageaction($mode='init_exportadv',array('index_name'=>'action','index_id'=>$index_mid));
$url="?$return";
break;
case 'export': // 第二项导出功能,函数在init.php文件中
$return=FormPageAction("action",$index_mid);
//$return=returnpageaction($mode='init_exportadv',array('index_name'=>'action','index_id'=>$index_mid));
$url="?$return"; // 明码为?pageid=1&action=export_default
break;
default:
$group_array=return_parent_group(); // 没有定义内容 if(sizeof($group_array['sql_text'])>1) {
$temp_get_parent=isset($_GET[(string)$group_array['sql_text']['parent']])?$_GET[(string)$group_array['sql_text']['parent']]:0;
$temp_get=$_GET[(string)$group_array['sql_text']['id']];
$temp_get=isset($temp_get)?$temp_get:0;
switch($group_array['sql_text']['type']) {
case 'group':
$sql_text_user=$group_array['sql_text']['user']."=".$_GET[(string)$group_array['sql_text']['user']];
break;
case 'user':
$sql_text_user='';
break;
default:
$sql_text_user='';
break;
} }
else { //$return=FormPageAction("action",$index_mid);
//exit($return);
$return=base64_encode("action=".$index_mid); // add_default
//$return=returnpageaction($mode='init_add',array('index_name'=>'action','index_id'=>$index_mid));
$url="?$return"; }
break;
}
//if($index!='init') $array[$i]['value']=" ".$common_html['common_html'][$index]." ";
$array[$i]['title']=" ".$common_html['common_html'][$index]." ";
$array[$i]['url']=$url; // 保存action
$array[$i]['shortcut']=$model_index_array[2];
$array[$i]['class']='SmallButton';
//}
}//end switch
}//end 用户权限划分 //系统调试模式
global $systemmode;
if($systemmode=='test') {
$array[$i+1]['value']=" ".$common_html['common_html']['setlang']." ";
$array[$i+1]['title']=" ".$common_html['common_html']['setlang']." ";
$array[$i+1]['url']="systemlang_newai.php?action=init_default&tablename=$tablename";
$array[$i+1]['shortcut']='t';
$array[$i+1]['class']='SmallButton';
}
//print_R($array);
print_new_element_array($array,$location_title); // $location_title为sunshine_inside,在html_element.php中,见下
}

print_new_element_array()函数如下:

 function print_new_element_array($array,$location_title='')    {
global $html_etc,$common_html;
global $lang;
if($location_title!='sunshine_inside') {
print "<div align=\"center\">\n";
}
if(!is_array($array)) $array = array();
foreach($array as $list) {
if(Trim($list['value'])!=""&&$_GET['actionadv']=='')
print "<input type=\"button\" accesskey=\"".$list['shortcut']."\" value=\"".$list['value']."\" class=".$list['class']." onClick=\"location='".$list['url']."';\" title=\"".$common_html['common_html']['accesskey'].":ALT+".$list['shortcut']."\">\n"; // 为每一个按钮设置值,onClick也是向自身传递参数
}
if($location_title!='sunshine_inside') {
print "</div>\n";
print "<br>\n";
}
}

FormPageAction()函数在init.php文件中,函数如下:

 //形成新的_GET字符变量
function FormPageAction($actionname='',$actionvalue='',$actionname2='',$actionvalue2='',$delete='',$actionname3='',$actionvalue3='',$actionname4='',$actionvalue4='') {
global $_GET;
//print_R($_REQUEST);
//##################################################################
//2009-3-23增加在搜索情况下面对分页条件的支持 旧版:$_GET2 = $_GET;
//##################################################################
//变量初始化
$_GET['action'] = $_GET['action'];
$_GET2 = $_GET; //附加新的变量值
if($actionname!=""&&$actionvalue!="") // 对action进行修改
$_GET2[$actionname]=$actionvalue;
if($actionname2!=""&&$actionvalue2!="")
$_GET2[$actionname2]=$actionvalue2;
if($actionname3!=""&&$actionvalue3!="")
$_GET2[$actionname3]=$actionvalue3;
if($actionname4!=""&&$actionvalue4!="")
$_GET2[$actionname4]=$actionvalue4;
//构成KEY表
$array_keys = array_keys($_GET2);//print_R($_GET2);// 就2项:pageid:1,action:export_default
//过滤,形成新的数组
for($i=0;$i<sizeof($array_keys);$i++) {
if($_GET2[(String)$array_keys[$i]]!=""&&$array_keys[$i]!=$delete) {// 执行
$urlitem=$_GET2[(String)$array_keys[$i]]; // 1
$urlitem=str_replace("\'","'",$urlitem); // 1
if(stripos($urlitem,"'")!==false)
$urlitem=urlencode($urlitem); // 解码 1
$array_line[$i] = $array_keys[$i]."=".$urlitem;// 0:pageid=1,1:action=export_default
}
else {
}
} if(sizeof($array_line)>0)
$newtext = join("&",$array_line);// 为pageid=1&action=export_default //return $newtext;
return base64_encode($newtext);
}