PageRenderTime 32ms CodeModel.GetById 9ms app.highlight 18ms RepoModel.GetById 1ms app.codeStats 0ms

/source/gl/module/l.php

http://prosporous.googlecode.com/
PHP | 423 lines | 393 code | 15 blank | 15 comment | 38 complexity | 52d6c96ed290cc5319c96c8f895694e8 MD5 | raw file
  1<?php
  2/**??????UTF-8???.
  3 * Created on 2010-6-27
  4 *
  5 * @author EXT <isrn@qq.com>
  6 *
  7 */
  8include ('../../includes/global.php');
  9include ('../global.php');
 10include ("../power.php");
 11//require_once './render.php';
 12//require_once './items_config.php';
 13$dbcfg=Sys::Gp(array('dbcfg','sevenel'));
 14$donotrender = array('htmleditor','fckeditor','password','hidden');
 15
 16 switch($_REQUEST['op']){
 17	case 'list':{
 18			$fldata=Dgd(array(
 19			  'db'=>'d_sevenel',
 20			  'cd'=>"tid = '".$_GET['tid']."' order by px asc ",
 21			  'tn'=>"fld"
 22			));
 23		Tr($fldata,'fld');
 24		Tr($_GET['bdtid'],'bdtid');
 25		Tr($_GET['bdid'],'bdid');
 26		foreach($fldata as $key =>$v){
 27				if($v['xr']==0){
 28					$xr[]=$v;
 29					}
 30				if($v['gj']==1){
 31					$gj[]=$v;
 32					}
 33			}
 34		Tr($xr,'xr');
 35		if($gj!=''){
 36		foreach($gj as $key =>$value){
 37			if($value['cfg']!=''){
 38			$config =json_decode($value['cfg'],true);
 39			}else{$config =''; }
 40			$config['STR']=str_replace("\r","",$config['STR']);
 41			$config['STR']=str_replace("\n","",$config['STR']);
 42			$config['STR']=str_replace("\t","",$config['STR']);
 43			switch($value['type']){
 44				case 'datefield':{
 45						$js[] ="{
 46							xtype: 'datefield',
 47							value:\"\",
 48							fieldLabel:'".$value['name']."',
 49							".(($value['id'])?("id:'".$value['id']."',"):(""))."
 50							".(($config['STR'])?("".$config['STR'].""):(""))."
 51							".(($config['zqgs'])?("format:'".$config['zqgs']."',"):(""))."
 52							name: '".$value['fname']."'
 53							}";
 54							break;}
 55				case 'combo':{
 56								$tempxx = json_decode($value['zyz'],true);
 57								$config_num = count($tempxx);
 58								$items='';
 59								if($config_num != 0){
 60									foreach($tempxx as $key => $data){
 61										if($data['ck']=='1'){
 62											$xzz=$data['xv'];}
 63											$items.= "['".$data['xv']."','".$data['yv']."']";
 64										if($key < $config_num-1){
 65											$items.= ",";
 66										}
 67									}
 68								}
 69						$js[] ="{
 70							value:\"".$xzz."\",
 71							fieldLabel:'".$value['name']."',
 72							".(($value['id'])?("id:'".$value['id']."',"):(""))."
 73							".(($value['width'])?("width:".$value['width'].","):(""))."
 74							".(($config['readonly'])?("readOnly:'true',"):(""))."
 75							typeAhead: true,
 76							name: '".$value['fname']."_',
 77							hiddenName : '".$value['fname']."',
 78							editable: false,xtype: 'combo',
 79							store:new Ext.data.SimpleStore({
 80											fields:['name','value'],
 81											data:[".$items."]}),
 82							mode:'local',
 83					        displayField:'name',
 84					        selectOnFocus:true,
 85					        valueField :'value',
 86					        triggerAction:'all'
 87
 88							}";
 89				break;}
 90				case 'combo1':{
 91								
 92						$js[] ="{
 93							".$back."
 94							value:\"".(adxx($fdada[$value['fname']])?adxx($fdada[$value['fname']]):$config['dy'])."\",
 95							fieldLabel:'".$value['name']."',
 96							".(($value['id'])?("id:'".$value['id']."',"):(""))."
 97							".(($value['width'])?("width:".$value['width'].","):(""))."
 98							".((!$value['yxwk'])?("allowBlank:false,blankText:'".adxx($value['ts'])."',"):(""))."
 99							".(($config['readonly'])?("readOnly:'true',"):(""))."
100							typeAhead: true,
101							emptyText:'".$config['dx']."',
102							name: '".$value['fname']."_',
103							id: '".$value['fname']."_',
104							hiddenName : '".$value['fname']."',
105							editable: false,xtype: 'combo',
106							store:new Ext.data.Store({   
107								proxy: new Ext.data.HttpProxy({   
108									url: '../cascade/getcascade.php?id=".$value['id']."'
109								}),
110								listeners : { 
111								load : function(){ 
112										
113										if(typeof(chuzai)=='undefined'){
114											Ext.getCmp('".$value['fname']."_"."').setValue('".(adxx($fdada[$value['fname']])?adxx($fdada[$value['fname']]):$config['dy'])."'); 
115											chuzai=1;
116											}
117										} 
118										} ,
119								autoLoad:true,
120								reader: new Ext.data.ArrayReader({   
121							}, [   
122								{name: '".$config['y']."', mapping: '".$config['y']."'},   
123								{name: '".$config['x']."', mapping: '".$config['x']."'}   
124							])   
125}),
126							mode:'local',
127					        displayField:'".$config['x']."',
128					        selectOnFocus:true,
129					        valueField :'".$config['y']."',
130							".(($config['STR'])?("".$config['STR'].""):(""))."
131					        triggerAction:'all'
132								
133							}";
134				break;}
135				case 'radiogroup':{
136								$tempxx = json_decode($value['zyz'],true);
137								$config_num = count($tempxx);
138								if($config_num != 0){
139									$items='';
140									foreach($tempxx as $key => $data){
141										if($data['ck']=='1'){
142											$items.= "{boxLabel:'".$data['xv']."',name:'".$value['fname']."',inputValue:'".$data['yv']."',checked: true}";}else{
143											$items.= "{boxLabel:'".$data['xv']."',name:'".$value['fname']."',inputValue:'".$data['yv']."'}";}
144										if($key < $config_num-1){
145											$items.= ",";
146										}
147									}
148								}
149						$js[] ="{
150							xtype: 'radiogroup',
151							".(($value['width']&&$value['width']<=$config_num)?("columns:".$value['width'].","):(""))."
152							".(($config['vertical'])?("vertical: true,"):(""))."
153							anchor: '95%',
154							 items: [".$items."],
155							fieldLabel:'".$value['name']."'
156							}";
157				break;}
158				case 'recommend':{
159							$items='';
160								$items.= "{boxLabel:'???',name:'".$value['fname']."',inputValue:'1'},";
161								$items.= "{boxLabel:'???',name:'".$value['fname']."',inputValue:'0',checked: true}";
162								
163						$js[] ="{
164							xtype: 'radiogroup',
165							anchor: '95%',
166							 items: [".$items."],
167							fieldLabel:'".$value['name']."'
168							}";
169				break;}
170				case 'checkboxgroup':{
171								$tempxx = json_decode($value['zyz'],true);
172								$config_num = count($tempxx);
173								if($config_num != 0){
174									$items='';
175									foreach($tempxx as $key => $data){
176									$ckbox[]=$value['fname']."[".$key."]";	
177										if($data['ck']=='1'){
178											$items.= "{boxLabel:'".$data['xv']."',name:'".$value['fname']."[".$key."]',inputValue:'".$data['yv']."',checked: true}";}else{
179											$items.= "{boxLabel:'".$data['xv']."',name:'".$value['fname']."[".$key."]',inputValue:'".$data['yv']."'}";}
180										if($key < $config_num-1){
181											$items.= ",";
182										}
183										}
184								}
185						$js[] ="{
186							xtype:'checkboxgroup',
187							".(($value['width']&&$value['width']<=$config_num)?("columns:".$value['width'].","):(""))."
188							".(($config['vertical'])?("vertical: true,"):(""))."
189							anchor: '95%',
190							 items: [".$items."],
191							fieldLabel:'".$value['name']."'
192							}";
193				break;}
194				default:{
195						$js[] ="{
196							xtype: 'textfield',
197							value:\"\",
198							fieldLabel:'".$value['name']."',
199							".(($value['id'])?("id:'".$value['id']."',"):(""))."
200							".(($value['width'])?("width:'".$value['width']."px',"):("grow:true,growMin:68,growMax:300,"))."
201							".(($config['STR'])?("".$config['STR'].""):(""))."
202							name: '".$value['fname']."'
203							}";
204						}
205		  }
206		}
207		}
208		Tr($ckbox,'ckbox');
209		Tr($js,'js');
210		$tree=Dgd(array(
211			  'db'=>'d_sevenel',
212			  'cd'=>"id = '".$_GET['tid']."' ",
213			  'tn'=>"tree",
214			  'limit'=>1
215			));
216		Tr($tree,'tree');
217		if($tree['expand']){
218		$fstree=Dgd(array(
219			  'db'=>'d_sevenel',
220			  'cd'=>"id in (0,".$tree['expand'].") ",
221			  'tn'=>"tree"
222			));}
223		$fsstr='';
224		if($fstree){
225		foreach($fstree as $fsvalue){
226		$fsstr.=",{xtype:\"button\",text:\"??".$fsvalue['title']."\",iconCls:\"fsadd\",pressed:true,handler:function(){
227				var record = grid.getStore().getAt(rowIndex); 
228				fsadd('".$fsvalue['id']."','".$fsvalue['title']."',\"./show1/i.php?op=add&tid=".$fsvalue['id']."&bdtid=".$_GET['tid']."&bdid=\",record.data.id);		}}
229				,{xtype:\"button\",text:\"??".$fsvalue['title']."\",iconCls:\"fslist\",pressed:true,handler:function(){
230				var record = grid.getStore().getAt(rowIndex); 
231				fslist('".$fsvalue['id']."','".$fsvalue['title']."',\"./show1/l.php?op=list&tid=".$fsvalue['id']."&bdtid=".$_GET['tid']."&bdid=\",record.data.id);
232					}}";				
233			}}
234		Tr($fsstr,'fstree');
235		
236		$table=Dgd(array(
237			  'db'=>'d_sevenel',
238			  'cd'=>"id = '".$tree['table']."' ",
239			  'tn'=>"datamod",
240			  'limit'=>1
241			));
242		Tr($table,'table');
243		
244		Ts('user/list.html');
245		break;
246		}
247	case 'fy':{
248			if($_SESSION['rcg']!='A'&&!$_SESSION['rcg']['c'][$_POST['tid']]){
249				$pt=" and user like '".$_SESSION['userinfo']['user']."' ";
250				}
251			$fldata=Dgd(array(
252			  'db'=>'d_sevenel',
253			  'cd'=>"tid = '".$_POST['tid']."'  order by px asc ",
254			  'tn'=>"fld"
255			));
256			$zhuanyi=array();
257			$btsc=array();
258			$gjsc=array();
259			foreach($fldata as $key=>$value){
260					if($value['zy']==1){
261						$zhuanyi[]=$value;
262						}
263					if($value['bt']==1){
264						$btsc[$value['fname']]=$value['type'];
265						}
266					if($value['gj']==1){
267						$gjsc[]=$value;
268						}
269				}
270			$condition='';
271			$_POST['user']&&$condition.="and user like '%".$_POST['user']."%' ";
272			$_POST['bdtid']&&$condition.="and bdtid = '".$_POST['bdtid']."' ";
273			$_POST['bdid']&&$condition.="and bdid = '".$_POST['bdid']."' ";
274			 if($gjsc){
275				 $xzt=array('combo','recommend','radiogroup');
276				foreach($gjsc as $value){
277					if(in_array($value['type'],$xzt)){
278					$_POST[$value['fname']]!=''&&$condition.="and ".$value['fname']." = '".$_POST[$value['fname']]."' ";
279						}else{
280							if($value['type']=='checkboxgroup'){
281								if($_POST[$value['fname']]){
282								 foreach($_POST[$value['fname']] as $cv){
283					$cv!=''&&$condition.="and ".$value['fname']." like '%".$cv."%' ";
284									 }
285									}
286								}else{
287					$_POST[$value['fname']]!=''&&$condition.="and ".$value['fname']." like '%".$_POST[$value['fname']]."%' ";
288									}
289							}
290					} 
291				 }
292			$dbinfo=Dgd(array(
293					  'db'=>'d_sevenel',
294					  'tn'=>$_POST['dbname'],
295					  'start'=>$_POST['start'],
296					  'limit'=>$_POST['limit'],
297					  'total'=>true,
298					 // 'ce'=>1,
299					  'cd'=>" 1 and tid = '".$_POST['tid']."' ".$condition." and del != '1' ".$pt." order by id desc "
300					  ));
301			//??
302			
303			
304			//??
305			
306		foreach($dbinfo['data'] as $key =>$value){
307						foreach($zhuanyi as $zyv){
308								switch($zyv['type']){
309									case 'fileup':{
310										//echo $dbinfo['data'][$key][$zyv['fname']];
311										$config=json_decode($zyv['cfg'],true);
312										$dvalue=array( 0=>array('rar','zip','tar','.tz'),
313													   1=>array('jpg','gif','png','bmp'),
314													   2=>array('mp3','mp4','avi','wmv','mid','.rm','mvb','mov','wma','wav'),
315													   3=>array('doc','xls','txt','ocx','lsx','ppt','pdf','chm'),
316													   4=>array('doc','xls','txt','ocx','lsx','ppt','pdf','chm','mp3','mp4','avi','wmv','mid','.rm','mvb','mov','wma','wav','jpg','gif','png','bmp','rar','zip','tar','.tz')		   
317															   );
318										$otype=substr(strtolower($dbinfo['data'][$key][$zyv['fname']]),-3);
319												if(in_array($otype,$dvalue[0])){
320												$dbinfo['data'][$key][$zyv['fname']]="<a href=\"/uplods/pic/".$dbinfo['data'][$key][$zyv['fname']]."\" target='_blank'><img src=\"../img/archive.png\">??[Download]</a>";
321													}
322												if(in_array($otype,$dvalue[1])){
323													if($config['sl1']==1){
324													$dbinfo['data'][$key][$zyv['fname']]="<img src=\"/uplods/thumb1/".$dbinfo['data'][$key][$zyv['fname']]."\" >";	
325														}elseif($config['sl2']==1){
326													$dbinfo['data'][$key][$zyv['fname']]="<img src=\"/uplods/thumb2/".$dbinfo['data'][$key][$zyv['fname']]."\" >";	
327															}elseif($config['sypic']==1||$config['sytxt']==1){
328													$dbinfo['data'][$key][$zyv['fname']]="<img src=\"/uplods/sytp/".$dbinfo['data'][$key][$zyv['fname']]."\"  width=\"100px\">";	
329															}else{
330													$dbinfo['data'][$key][$zyv['fname']]="<img src=\"/uplods/pic/".$dbinfo['data'][$key][$zyv['fname']]."\"  width=\"100px\">";	
331																}
332													}
333												if(in_array($otype,$dvalue[2])){
334												$dbinfo['data'][$key][$zyv['fname']]="<a href=\"/uplods/pic/".$dbinfo['data'][$key][$zyv['fname']]."\" target='_blank'><img src=\"../img/film_link.png\">??[Download]</a>";
335													}
336												if(in_array($otype,$dvalue[3])){
337												$dbinfo['data'][$key][$zyv['fname']]="<a href=\"/uplods/pic/".$dbinfo['data'][$key][$zyv['fname']]."\" target='_blank'><img src=\"../img/report_word.png\">??[Download]</a>";
338													}
339										break;	
340										}
341									case 'radiogroup':{	
342									$tempxx = json_decode($zyv['zyz'],true);
343									foreach($tempxx as $value){
344											if($value['yv']==$dbinfo['data'][$key][$zyv['fname']]){
345											$dbinfo['data'][$key][$zyv['fname']]=$value['xv'];
346												}
347										}
348										break;
349										}
350									case 'checkboxgroup':{	
351									$tempxx = json_decode($zyv['zyz'],true);
352									$nowv=explode('#_#',$dbinfo['data'][$key][$zyv['fname']]);
353									$dbinfo['data'][$key][$zyv['fname']]='';
354									foreach($tempxx as $value){
355											if(in_array($value['yv'],$nowv)){
356											$dbinfo['data'][$key][$zyv['fname']].=$value['xv']."<BR>";
357												}
358										}
359										break;
360										}
361									case 'combo':{	
362									$tempxx = json_decode($zyv['zyz'],true);
363									foreach($tempxx as $value){
364											if($value['yv']==$dbinfo['data'][$key][$zyv['fname']]){
365											$dbinfo['data'][$key][$zyv['fname']]=$value['xv'];
366												}
367										}
368										break;
369										}
370									case 'combo1':{
371										$config =json_decode($zyv['cfg'],true);
372										$tq=Dgd(array(
373										  'db'=>'d_sevenel',
374										  'tn'=>$config['table'],
375										  'cd'=> " ".$config['y']." = '".$dbinfo['data'][$key][$zyv['fname']]."' and  ".$config['conditon'],
376										  'limit'=>1
377
378										  ));
379									$dbinfo['data'][$key][$zyv['fname']]=$tq[$config['x']];
380										break;
381								}
382									case 'recommend':{	
383										$config=json_decode($zyv['cfg'],true);
384										if($dbinfo['data'][$key][$zyv['fname']]!=0){
385											$dbinfo['data'][$key][$zyv['fname']]="<a href=\"#\" onclick='gxzd(\"".$dbinfo['data'][$key]['id']."\",\"".$zyv['fname']."\",\"0\")' title=\"??????????\"  >  <img src=\"../img/".$config['paixu']."\"></a>    <a href=\"#\"  title=\"??[order]\"  onclick='tjpx(\"".$_POST['tid']."@".$_POST['dbname']."\",\"".$zyv['fname']."\")' >   <img src=\"../img/sucaiwcom8170000bzc.gif\" ait=\"??[order]\"></a>";
386												}else{
387											$dbinfo['data'][$key][$zyv['fname']]="<a href=\"#\" onclick='gxzd(\"".$dbinfo['data'][$key]['id']."\",\"".$zyv['fname']."\",\"1\")'  title=\"????????\"  ><img src=\"../img/flag.png\"></a> <a href=\"#\" title=\"??[order]\"   onclick='tjpx(\"".$_POST['tid']."@".$_POST['dbname']."\",\"".$zyv['fname']."\")' >  <img src=\"../img/sucaiwcom8170000bzc.gif\" ait=\"??[order]\"></a>";
388													}
389										break;
390										}
391									}
392							
393							}
394						
395				}
396/*				
397			$_SESSION['as']=$_SESSION['as']+10;
398			$dbinfo['as']=$_SESSION['as'];
399*/			echo json_encode($dbinfo);
400			break;
401		}
402	case 'width_change':{
403	$id=$_POST['id'];
404	Du('sevenel','fld',array('wd'=>$_POST['width']),'id',$id,1);
405	echo 'ok';
406	break;
407	}
408	case 'del':{
409	$_POST['del']=1;
410	$_POST['ids']=json_decode(stripslashes($_POST['ids']));
411	if(is_array($_POST['ids'])){
412		foreach($_POST['ids'] as $id){
413			Du('sevenel',$_POST['dbname'],$_POST,'id',$id,0);
414			}				   
415		}else{
416			Du('sevenel',$_POST['dbname'],$_POST,'id',$id,0);
417			}
418	 echo '{success:true,msg:\'ok\'}';
419	break;
420	}
421
422 }
423?>