wordxieModel.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. //文档协作
  3. class flow_wordxieClassModel extends flowModel
  4. {
  5. public function flowrsreplace($rs, $lx=0)
  6. {
  7. $rs['xiebool'] = false;
  8. $xienameid = $rs['xienameid'];
  9. if($rs['optid']==$this->adminid){
  10. $rs['xiebool'] = true;
  11. }else if(!isempt($xienameid)){
  12. if($this->adminmodel->containjoin($xienameid, $this->adminid))
  13. $rs['xiebool'] = true;
  14. }
  15. $str = '';
  16. if(arrvalue($rs,'isgk')=='1')$str='<font color=green>可做模版</font>';
  17. $rs['isgk'] = $str;
  18. return $rs;
  19. }
  20. protected function flowgetoptmenu($num)
  21. {
  22. //判断是否可协作
  23. if($num=='editfile'){
  24. $rs = $this->flowrsreplace($this->rs,0);
  25. if($rs['xiebool']){
  26. return array('officebj'=>getconfig('officebj')); //返回编辑方式
  27. }else{
  28. return false;
  29. }
  30. }
  31. }
  32. /**
  33. * 协作好了上传文件
  34. */
  35. public function savefile($fileid)
  36. {
  37. $fobj = m('file');
  38. $filename = ''.$this->rs['name'].'.'.$this->rs['wtype'].'';
  39. //把原来的文件名修改
  40. $ofrs = $fobj->getone($this->rs['fileid']);
  41. if($ofrs){
  42. $ofilename = ''.$this->rs['name'].'_'.$ofrs['optname'].'_'.date('YmdHis', strtotime($ofrs['adddt'])).'.'.$this->rs['wtype'].'';
  43. $fobj->update(array(
  44. 'filename' => $ofilename
  45. ),$this->rs['fileid']);
  46. }
  47. $this->update(array(
  48. 'fileid' => $fileid
  49. ), $this->id);
  50. $fobj->update(array(
  51. 'filename' => $filename,
  52. 'mid' => $this->id,
  53. 'mtype' => $this->mtable,
  54. 'mknum' => $this->modenum,
  55. ),$fileid);
  56. $this->addlog(array(
  57. 'name' => '上传文件'
  58. ));
  59. //通知给对应人
  60. return 'ok';
  61. }
  62. //在线编辑
  63. public function floweditoffice($frs, $ofrs)
  64. {
  65. $this->update("`optdt`='".$this->rock->now."'", $this->id);
  66. }
  67. }
粤ICP备19079148号