1
0

knowtikuModel.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. class flow_knowtikuClassModel extends flowModel
  3. {
  4. protected function flowchangedata(){
  5. $this->rs['content'] = c('html')->replace($this->rs['content']);
  6. }
  7. public $logobj,$typearr;
  8. public function initModel()
  9. {
  10. $this->logobj = m('log');
  11. $this->typearr= array('单选','多选','判断题');
  12. }
  13. public function flowrsreplace($rs,$isv=0)
  14. {
  15. if(isset($rs['typeid']))$rs['typeid'] = $this->db->getmou('[Q]option','name',"`id`='".$rs['typeid']."'");
  16. $rs['type'] = arrvalue($this->typearr, $rs['type']);
  17. if($isv==1){
  18. $ss = '<font color=#888888>停用</font>';
  19. if($rs['status']==1)$ss = '<font color=green>启用</font>';
  20. $rs['status'] = $ss;
  21. }
  22. if($isv==2){
  23. $zt = $this->logobj->isread($this->mtable, $rs['id'], $this->adminid);
  24. if($zt>0)$rs['ishui']=1;
  25. }
  26. return $rs;
  27. }
  28. protected function flowbillwhere($uid, $lx)
  29. {
  30. $where = '';
  31. $typeid = (int)$this->rock->post('typeid','0');
  32. $key = $this->rock->post('key');
  33. if($lx=='xuexi')$where='and a.`status`=1';
  34. if($typeid!='0'){
  35. $alltpeid = m('option')->getalldownid($typeid);
  36. $where .= ' and a.`typeid` in('.$alltpeid.')';
  37. }
  38. if($key != ''){
  39. $where.=" and (a.`title` like '%$key%' or b.`name` like '%$key%')";
  40. }
  41. return array(
  42. 'where' => $where,
  43. 'order' => 'a.`sort`,a.`optdt` desc',
  44. 'table' => '`[Q]'.$this->mtable.'` a left join `[Q]option` b on a.`typeid`=b.`id`',
  45. 'fields'=> 'a.*,b.name as typename',
  46. 'asqom' => 'a.'
  47. );
  48. }
  49. //导入数据的测试显示
  50. public function flowdaorutestdata()
  51. {
  52. $barr = array(
  53. 'title' => '信呼要求PHP最低版本',
  54. 'typeid' => '官网知识',
  55. 'type' => '单选',
  56. 'ana' => '5.2',
  57. 'anb' => '5.3',
  58. 'anc' => '5.4',
  59. 'and' => '5.5',
  60. 'answer' => 'B',
  61. 'explain' => '详见官网说明使用',
  62. );
  63. $barr1 = array(
  64. 'title' => '信呼要求MySql最低版本',
  65. 'typeid' => '官网知识',
  66. 'type' => '单选',
  67. 'ana' => '5.0',
  68. 'anb' => '5.3',
  69. 'anc' => '5.4',
  70. 'and' => '5.5',
  71. 'ane' => '',
  72. 'answer' => 'D',
  73. 'explain' => '详见官网说明使用',
  74. );
  75. $barr2 = array(
  76. 'title' => 'PHP如何连接数据库方式',
  77. 'typeid' => '技术姿势/PHP知识',
  78. 'type' => '多选',
  79. 'ana' => 'mysql',
  80. 'anb' => 'mysqli',
  81. 'anc' => 'pdo',
  82. 'and' => 'mssql',
  83. 'ane' => 'com',
  84. 'answer' => 'ABC',
  85. 'explain' => 'D选项为别的数据库',
  86. );
  87. $barr3 = array(
  88. 'title' => '信呼官网域名是rockoa.com',
  89. 'typeid' => '官网知识',
  90. 'type' => '判断题',
  91. 'ana' => '正确',
  92. 'anb' => '错误',
  93. 'anc' => '',
  94. 'and' => '',
  95. 'answer' => 'A',
  96. 'explain' => '',
  97. );
  98. return array($barr,$barr1,$barr2,$barr3);
  99. }
  100. //导入之前
  101. public function flowdaorubefore($rows)
  102. {
  103. $inarr = array();
  104. $num = 'knowtikutype';
  105. if(ISMORECOM && $cnum=$this->adminmodel->getcompanynum())$num.='_'.$cnum.'';
  106. foreach($rows as $k=>$rs){
  107. $rs['typeid'] = $this->option->gettypeid($num,$rs['typeid']);
  108. $types = arrvalue($rs,'type');
  109. $type1 = 0;
  110. if($types=='多选')$type1 = 1;
  111. if($types=='判断题')$type1 = 2;
  112. $rs['type'] = $type1;
  113. $inarr[] = $rs;
  114. }
  115. return $inarr;
  116. }
  117. }
粤ICP备19079148号