public static function getFname($fid)
 {
     if (!empty($fid)) {
         $data = WriteModel::getCategory($fid);
         return $data['name'];
     }
     return null;
 }
 public function show()
 {
     if (!is_dir(WORD_PAGE . $_SESSION['uid'])) {
         $path = WORD_PAGE . $_SESSION['uid'];
         $res = mkdir(iconv("UTF-8", "GBK", $path), 0777, true);
         if (!$res) {
             $this->error("请修改Word目录权限!");
         }
     }
     if (!is_file(WORD_PAGE . $_SESSION['uid'] . "/" . I('epaperId') . ".doc")) {
         $docPath = WORD_PAGE . $_SESSION['uid'] . "/" . I('epaperId') . ".doc";
         copy(WORD_PAGE . "/expage.doc", $docPath);
         chmod($docPath, 0755);
     }
     //        $this->assign("pagePath",__ROOT__."/Word/page/".$_SESSION['uid']."/".I('epaperId').".doc");
     // dump($_SESSION);
     $array = $this->epaper = M('epaper')->where(array('id' => I('epaperId')))->find();
     session('testid', $array['testid']);
     session('epaperId', I('epaperId'));
     /* session('testid',trim($array['testid'], ",")); */
     $str = explode(',', trim($array['testid'], ","));
     $this->count = 0;
     $this->Xcount = 0;
     if (session('testid')) {
         $this->count = M('Write')->where(array('id' => array(in, $_SESSION['testid'])))->count();
         // $this->Jcount = M('Write')->where(array('id'=>array(in,$_SESSION['testid']),'questions'=>'简答题'))->count();
         $this->Xcount = M('Write')->where(array('id' => array(in, $_SESSION['testid']), 'questions' => '选择题'))->count();
         // $this->Tcount = M('Write')->where(array('id'=>array(in,$_SESSION['testid']),'questions'=>'填空题'))->count();
         // $this->TCount = count(session('testid')) - $this->
     }
     foreach ($str as $n => $v) {
         $test = M('write')->where(array('status' => 0, 'id' => $v))->find();
         if (!empty($test)) {
             $test['fname'] = WriteModel::getFname($test['fid']);
             if ($test['questions'] == "选择题") {
                 $all['select'][] = $test;
             } elseif (WriteModel::isElective($test['fid'])) {
                 $all['xuanxiu'][$test['fid']][] = $test;
             } else {
                 $all['notselect'][] = $test;
             }
         }
         /*$all[$n]=$test;
         		$all[$n]['test']=htmlspecialchars_decode($test['test']);*/
     }
     $this->assign('list', $all);
     $this->display();
 }