wordAction.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <?php
  2. class wordClassAction extends Action
  3. {
  4. public function getmywordtypeAjax()
  5. {
  6. $showlx = (int)$this->post('showlx',0); //0个人,1部门
  7. $bo = $showlx==1;
  8. $pid = m('word')->getfolderid($this->adminid, $bo);
  9. $rows = m('word')->getfoldrows($this->adminid, $bo);
  10. $rows = array(
  11. 'rows' => $rows,
  12. 'pid' => $pid
  13. );
  14. $this->returnjson($rows);
  15. }
  16. public function getshatewordtypeAjax()
  17. {
  18. $rows = array();
  19. $rows = array(
  20. 'rows' => $rows
  21. );
  22. $this->returnjson($rows);
  23. }
  24. public function wordbeforeaction($table)
  25. {
  26. $typeid = (int)$this->post('typeid',0);
  27. $showlx = (int)$this->post('showlx',0); //0个人,1部门
  28. $bo = $showlx==1;
  29. if($showlx==0){
  30. //$pid = m('word')->getfolderid($this->adminid);
  31. //$where = " and a.optid=".$this->adminid."";
  32. }else{
  33. }
  34. $pid = m('word')->getfolderid($this->adminid, $bo);
  35. $alltpeid = $this->option->getalldownid($pid);
  36. $where = " and a.typeid in($alltpeid)";
  37. if($pid==$typeid || $typeid==0){
  38. }else{
  39. $alltpeid = $this->option->getalldownid($typeid);
  40. $where.=" and a.typeid in($alltpeid)";
  41. }
  42. return array(
  43. 'table' => '`[Q]word` a left join `[Q]file` b on a.fileid=b.id left join `[Q]option` c on c.id=a.typeid',
  44. 'fields'=> 'b.id,a.shate,a.typeid,b.filepath,a.optname,a.optid,a.optdt,b.filename,b.fileext,b.filesizecn,b.downci,c.`name` as typename',
  45. 'where' => "and b.id is not null $where",
  46. 'order' => 'a.id desc'
  47. );
  48. }
  49. public function savefileAjax()
  50. {
  51. $typeid = (int)$this->post('typeid',0);
  52. $sid = $this->post('sid');
  53. $sadid = explode(',', $sid);
  54. $arr['optid'] = $this->adminid;
  55. $arr['optname'] = $this->adminname;
  56. $arr['optdt'] = $this->now;
  57. $arr['typeid'] = $typeid;
  58. $file = m('file');
  59. foreach($sadid as $fid){
  60. $arr['fileid'] = $fid;
  61. $sid = m('word')->insert($arr);
  62. $file->addfile($fid, 'word', $sid, 'word');
  63. }
  64. echo 'ok';
  65. }
  66. public function sharefileAjax()
  67. {
  68. $fileid = c('check')->onlynumber($this->post('fid','0'));
  69. $arr['shateid'] = $this->post('sid');
  70. $arr['shate'] = $this->post('sna');
  71. m('word')->update($arr, "optid='$this->adminid' and fileid in($fileid)");
  72. }
  73. public function sharefileerAjax()
  74. {
  75. $fileid = (int)$this->post('fid','0');
  76. $arr['receid'] = $this->post('sid');
  77. $arr['recename'] = $this->post('sna');
  78. m('option')->update($arr, "id ='$fileid'");
  79. }
  80. public function shatebefore($talbe)
  81. {
  82. $key = $this->post('key');
  83. $atype = $this->post('atype');
  84. $where = m('admin')->getjoinstrs('a.shateid', $this->adminid, 1);
  85. $optid = 0;
  86. if($atype=='wfx'){
  87. $where = " and a.optid=".$this->adminid." and a.shate is not null";
  88. $optid = $this->adminid;
  89. }
  90. $alsid = $this->option->getreceiddownall($this->adminid, $optid);
  91. if($alsid != ''){
  92. $where = ' and ((1 '.$where.') or a.`typeid` in('.$alsid.') )';
  93. }
  94. if($key!=''){
  95. $where.=" and (a.`optname` like '%$key%' or b.`filename` like '%$key%' or c.`name` like '%$key%')";
  96. }
  97. return array(
  98. 'table' => '`[Q]word` a left join `[Q]file` b on a.fileid=b.id left join `[Q]option` c on c.id=a.typeid',
  99. 'where' => 'and b.id is not null '.$where.'',
  100. 'fields'=> 'b.id,a.shate,a.typeid,a.optname,a.optid,b.filepath,a.optdt,b.filename,b.fileext,b.filesizecn,b.downci,c.`name` as typename',
  101. 'order' => 'a.id desc'
  102. );
  103. }
  104. public function delwordAjax()
  105. {
  106. $fid = (int)$this->post('id','0');
  107. m('word')->delete("`fileid`='$fid'");
  108. m('file')->delfile($fid);
  109. backmsg();
  110. }
  111. //移动
  112. public function movefileAjax()
  113. {
  114. $fid = c('check')->onlynumber($this->post('fid','0'));
  115. $tid = (int)$this->post('tid','0');
  116. m('word')->update("`typeid`='$tid'","`fileid` in ($fid)");
  117. }
  118. }
粤ICP备19079148号