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