How to use testClass method of sizeOf class

Best Atoum code snippet using sizeOf.testClass

BuildpaperController.class.php

Source:BuildpaperController.class.php Github

copy

Full Screen

1<?php2namespace Home\Controller;3use Think\Controller;4use Think\Image;5require 'Public/tcpdf/tcpdf.php';6//use vendor\crop;7class BuildpaperController extends Controller8{9 public function index()10 {11 $this->display();12 }13 public function phpuserupload()14 {15 $username = $_POST['username'];16 $password = $_POST['password'];17 $model = M('user_data');18 $data = $model->where(array('username' => $username, 'pwd' => $password))->find();19 $id=$data['id'];20 $userdata['username']=$username;21 if($id>0)22 {23 $userdata['id']=$id;24 echo json_encode($userdata);25 }26 else27 {28 $userdata['id']=0;29 echo json_encode($userdata);30 }31 }32 public function buildpage01()33 {34 $userid=$_GET['userid'];35 $this->assign('userid',$userid);36 $this->display();37 }38 public function gradelevelsub()39 {40 $id=$_POST[id];41 $model_user=M('user_data');42 $model_grade=M('grade_data');43 $model_school=M('school_data');44 $User_Data=$model_user->where('id='.$id)->find();45 $schoolid=$User_Data['schoolid'];46 $school_Data=$model_school->where('school_id='.$schoolid)->find();47 $schoollevel=$school_Data['levelnum'];48 $grade_Data=$model_grade->where('levelnum='.$schoollevel)->select();49 $grade_Data['count']=sizeof($grade_Data);50 echo json_encode($grade_Data);51 }52 public function phpsubjectsub()53 {54 $model_subject=M('subject_data');55 $subjectdata=$model_subject->select();56 $subjectdata['count']=sizeof($subjectdata);57 echo json_encode($subjectdata);58 }59 public function phpgradesub(){60 $gradeid=$_POST[checkgradeid];61 $subjectid=$_POST[subjectid];62 $model_grade=M('grade_data');63 $model_chapter=M('chapter_msg');64 //$grade_data65 $gradeidarr=explode(',',$gradeid);66 $count=sizeof($gradeidarr);67 $newchapter='';68 $n=0;69 for($m=0;$m<$count;$m++)70 {71 $gradedata=$model_grade->where('id='.$gradeidarr[$m])->find();72 $gradeid=$gradeidarr[$m];73 $grademsg=$gradedata['grademsg'];74 $newchapter[$n]['chaptermsg']=$grademsg;75 $newchapter[$n]['kind']='grade';76 $newchapter[$n]['id']='999';77 $arr['gradeid']=$gradeid;78 $arr['subjectid']=$subjectid;79 $arr['displayornot']=1;80 $chapterdata=$model_chapter->where($arr)->select();81 $chaptercount=sizeof($chapterdata);82 $n=$n+1;83 for($k=0;$k<$chaptercount;$k++)84 {85 $newchapter[$n]['chaptermsg']=$chapterdata[$k]['chaptermsg'];86 $newchapter[$n]['kind']='chapter';87 $newchapter[$n]['id']=$chapterdata[$k]['id'];88 $n=$n+1;89 }90 }91 $newchapter['count']=sizeof($newchapter);92 echo json_encode($newchapter);93 }94 public function phpclasssub()95 {96 $userid=$_POST['id'];97// $userid=79;98 $model=M('user_teacher_addation_data');99 $model_class=M('class_data');100 $classid=$model->where('userid='.$userid)->find();101 $classarr=explode(',',$classid['classarray']);102 $count=sizeof($classarr);103 for($i=0;$i<$count;$i++)104 {105 $classdata=$model_class->where('id='.$classarr[$i])->find();106 $newclassarr[$i]['id']=$classarr[$i];107 $newclassarr[$i]['classname']=$classdata['classname'];108 }109 $newclassarr['count']=sizeof($newclassarr);110 echo json_encode($newclassarr);111 }112 public function phpquestionsub()113 {114 $subjectid=$_POST['subjectid'];115 $question_model=M('questiontypes');116 $questiondata=$question_model->where('subjectid='.$subjectid)->order('orderid asc')->select();117 $questiondata['count']=sizeof($questiondata);118 echo json_encode($questiondata);119 }120 public function phpnextquestionsub()121 {122 $subjectid=$_POST['subjectid'];123 $questionidarr=$_POST['questionidarr'];124 $question_model=M('questiontypes');125 $questionidarr=explode(',',$questionidarr);126 $qcount=sizeof($questionidarr);127 $questiondata=$question_model->where('subjectid='.$subjectid)->order('orderid asc')->select();128 $count=sizeof($questiondata);129 $m=0;130 $kind=0;131 for($i=0;$i<$count;$i++)132 {133 for($j=0;$j<$qcount;$j++)134 {135 if($questionidarr[$j]==$questiondata[$i]['id'])136 {137 $kind=1;138 continue;139 }140 }141 if($kind==0)142 {143 $newdata[$m]['id']=$questiondata[$i]['id'];144 $newdata[$m]['typesmsg']=$questiondata[$i]['typesmsg'];145 $m=$m+1;146 }147 $j=0;148 $kind=0;149 }150 $newdata['count']=sizeof($newdata);151 echo json_encode($newdata);152 }153 public function phpchaptersub(){154 $checkchapter=$_POST['checkchapter'];155 $chapterarr=explode(',',$checkchapter);156 $length=sizeof($chapterarr);157 $keynoteid='';158 $keynotemsg='';159 $model=M('keynote_data');160 for($i=0;$i<$length;$i++)161 {162 $keynotedata=$model->where('chapter='.$chapterarr[$i])->select();163 $keynotelength=sizeof($keynotedata);164 for($j=0;$j<$keynotelength;$j++)165 {166 $keynotedata[$j]['akeynote_id']=trimall($keynotedata[$j]['akeynote_id']);167 if($keynotedata[$j]['akeynote_id']!='')168 {169 if($j==0)170 {171 $keynoteid=$keynoteid.$keynotedata[$j]['akeynote_id'];172 $keynotemsg=$keynotemsg.$keynotedata[$j]['akeynotemsg'];173 }174 else175 {176 $keynoteid=$keynoteid.','.$keynotedata[$j]['akeynote_id'];177 $keynotemsg=$keynotemsg.','.$keynotedata[$j]['akeynotemsg'];178 }179 }180 }181 }182 $keynoteid=array_unique(explode(',',$keynoteid));183 $keynotemsg=array_unique(explode(',',$keynotemsg));184 $keynoteid=implode(',',$keynoteid);185 $keynotemsg=implode(',',$keynotemsg);186 $keynoteid=explode(',',$keynoteid);187 $keynotemsg=explode(',',$keynotemsg);188 $length=sizeof($keynoteid);189 for($m=0;$m<$length;$m++)190 {191 $keynotearr[$m]['id']=$keynoteid[$m];192 $keynotearr[$m]['msg']=$keynotemsg[$m];193 }194 $keynotearr['count']=sizeof($keynotearr);195 echo json_encode($keynotearr);196 }197//进行考试习题索引198 public function phptestsearch()199 {200 $id=$_POST['userid'];201 $subjectid=$_POST['subjectid'];202 $begintime=$_POST['begintime'];203 $endtime=$_POST['endtime'];204 $testtypekind=$_POST['testtypekind'];205 $keyword=$_POST['keyword'];206 $testchapterarr=$_POST['testchapterarr'];207 $typeid=$_POST['typeid'];208 $nowpage=$_POST['nowpage'];209 $pagelength=$_POST['pagelength'];210//211// $id=135;212// $subjectid=2;213// $begintime='';214// $endtime='';215// $testtypekind='';216// $keyword='';217// $testchapterarr='36,37,38,45,39,40,41,42,43,44,0';218// $typeid=20;219// $nowpage=2;220// $pagelength=5;221 $model_test=M('test_statistic');222 $all_arr['userid']=$id;223 $all_arr['subjectid']=$subjectid;224 $all_data=$model_test->where($all_arr)->field('id,testid,classidarr,groupidarr,testtime,testkind,chapterarr,paper_name,filesernum')->select();225 $all_count=sizeof($all_data);226 $m=0;227 for($i=0;$i<$all_count;$i++)228 {229 $classidarr=explode(',',$all_data[$i]['classidarr']);230 $groupidarr=explode(',',$all_data[$i]['groupidarr']);231 $testtime=explode(',',$all_data[$i]['testtime']);232 $testkind=explode(',',$all_data[$i]['testkind']);233 $chapterarr=explode(',',$all_data[$i]['chapterarr']);234 $class_count=sizeof($classidarr);235 for($n=0;$n<$class_count;$n++)236 {237 $newdata[$m]['id']=$all_data[$i]['id'];238 $newdata[$m]['testid']=$all_data[$i]['testid'];239 $newdata[$m]['paper_name']=$all_data[$i]['paper_name'];240 $newdata[$m]['filesernum']=$all_data[$i]['filesernum'];241 $newdata[$m]['classidarr']=$classidarr[$n];242 $newdata[$m]['groupidarr']=$groupidarr[$n];243 $newdata[$m]['testtime']=$testtime[$n];244 $newdata[$m]['testkind']=$testkind[$n];245 $newdata[$m]['chapterarr']=$chapterarr[$n];246 $m=$m+1;247 }248 }249 $count=sizeof($newdata);250 //通过时间进行索引251 if($begintime=='' && $endtime!='')252 {253 $m=0;254 for($k=0;$k<$count;$k++)255 {256 if($endtime>=date($newdata[$k]['testtime']))257 {258 $timedata[$m]['id']=$newdata[$k]['id'];259 $timedata[$m]['paper_name']=$newdata[$k]['paper_name'];260 $timedata[$m]['testid']=$newdata[$k]['testid'];261 $timedata[$m]['classidarr']=$newdata[$k]['classidarr'];262 $timedata[$m]['groupidarr']=$newdata[$k]['groupidarr'];263 $timedata[$m]['testtime']=$newdata[$k]['testtime'];264 $timedata[$m]['testkind']=$newdata[$k]['testkind'];265 $timedata[$m]['chapterarr']=$newdata[$k]['chapterarr'];266 $timedata[$m]['filesernum']=$newdata[$k]['filesernum'];267 $m=$m+1;268 }269 }270 }271 if($begintime!='' && $endtime=='' )272 {273 $m=0;274 for($k=0;$k<$count;$k++)275 {276 if($begintime<=date($newdata[$k]['testtime']))277 {278 $timedata[$m]['id']=$newdata[$k]['id'];279 $timedata[$m]['paper_name']=$newdata[$k]['paper_name'];280 $timedata[$m]['testid']=$newdata[$k]['testid'];281 $timedata[$m]['classidarr']=$newdata[$k]['classidarr'];282 $timedata[$m]['groupidarr']=$newdata[$k]['groupidarr'];283 $timedata[$m]['testtime']=$newdata[$k]['testtime'];284 $timedata[$m]['testkind']=$newdata[$k]['testkind'];285 $timedata[$m]['chapterarr']=$newdata[$k]['chapterarr'];286 $timedata[$m]['filesernum']=$newdata[$k]['filesernum'];287 $m=$m+1;288 }289 }290 }291 if($begintime!='' && $endtime!='' )292 {293 $m=0;294 for($k=0;$k<$count;$k++)295 {296 if($begintime<=date($newdata[$k]['testtime']) && $endtime>=date($newdata[$k]['testtime']))297 {298 $timedata[$m]['id']=$newdata[$k]['id'];299 $timedata[$m]['paper_name']=$newdata[$k]['paper_name'];300 $timedata[$m]['testid']=$newdata[$k]['testid'];301 $timedata[$m]['classidarr']=$newdata[$k]['classidarr'];302 $timedata[$m]['groupidarr']=$newdata[$k]['groupidarr'];303 $timedata[$m]['testtime']=$newdata[$k]['testtime'];304 $timedata[$m]['testkind']=$newdata[$k]['testkind'];305 $timedata[$m]['chapterarr']=$newdata[$k]['chapterarr'];306 $timedata[$m]['filesernum']=$newdata[$k]['filesernum'];307 $m=$m+1;308 }309 }310 }311 if($begintime=='' && $endtime=='')312 {313 $m=0;314 for($k=0;$k<$count;$k++)315 {316 $timedata[$m]['id']=$newdata[$k]['id'];317 $timedata[$m]['paper_name']=$newdata[$k]['paper_name'];318 $timedata[$m]['testid']=$newdata[$k]['testid'];319 $timedata[$m]['classidarr']=$newdata[$k]['classidarr'];320 $timedata[$m]['groupidarr']=$newdata[$k]['groupidarr'];321 $timedata[$m]['testtime']=$newdata[$k]['testtime'];322 $timedata[$m]['testkind']=$newdata[$k]['testkind'];323 $timedata[$m]['chapterarr']=$newdata[$k]['chapterarr'];324 $timedata[$m]['filesernum']=$newdata[$k]['filesernum'];325 $m=$m+1;326 }327 }328 $count=sizeof($timedata);329 if($keyword=='')330 {331 $m=0;332 for($k=0;$k<$count;$k++)333 {334 $keydata[$m]['id']=$timedata[$k]['id'];335 $keydata[$m]['paper_name']=$timedata[$k]['paper_name'];336 $keydata[$m]['testid']=$timedata[$k]['testid'];337 $keydata[$m]['classidarr']=$timedata[$k]['classidarr'];338 $keydata[$m]['groupidarr']=$timedata[$k]['groupidarr'];339 $keydata[$m]['testtime']=$timedata[$k]['testtime'];340 $keydata[$m]['testkind']=$timedata[$k]['testkind'];341 $keydata[$m]['chapterarr']=$timedata[$k]['chapterarr'];342 $keydata[$m]['filesernum']=$timedata[$k]['filesernum'];343 $m=$m+1;344 }345 }346 else347 {348 $m=0;349 for($k=0;$k<$count;$k++)350 {351 if(strstr($timedata[$k]['paper_name'],$keyword)!='')352 {353 $keydata[$m]['id']=$timedata[$k]['id'];354 $keydata[$m]['paper_name']=$timedata[$k]['paper_name'];355 $keydata[$m]['testid']=$timedata[$k]['testid'];356 $keydata[$m]['classidarr']=$timedata[$k]['classidarr'];357 $keydata[$m]['groupidarr']=$timedata[$k]['groupidarr'];358 $keydata[$m]['testtime']=$timedata[$k]['testtime'];359 $keydata[$m]['testkind']=$timedata[$k]['testkind'];360 $keydata[$m]['chapterarr']=$timedata[$k]['chapterarr'];361 $keydata[$m]['filesernum']=$timedata[$k]['filesernum'];362 $m=$m+1;363 }364 }365 }366 //考试类型索引367 $count=sizeof($keydata);368 if($testtypekind==0)369 {370 $m=0;371 for($k=0;$k<$count;$k++)372 {373 $testkinddata[$m]['id']=$keydata[$k]['id'];374 $testkinddata[$m]['paper_name']=$keydata[$k]['paper_name'];375 $testkinddata[$m]['testid']=$keydata[$k]['testid'];376 $testkinddata[$m]['classidarr']=$keydata[$k]['classidarr'];377 $testkinddata[$m]['groupidarr']=$keydata[$k]['groupidarr'];378 $testkinddata[$m]['testtime']=$keydata[$k]['testtime'];379 $testkinddata[$m]['testkind']=$keydata[$k]['testkind'];380 $testkinddata[$m]['chapterarr']=$keydata[$k]['chapterarr'];381 $testkinddata[$m]['filesernum']=$keydata[$k]['filesernum'];382 $m=$m+1;383 }384 }385 else386 {387 $m=0;388 for($k=0;$k<$count;$k++)389 {390 if($keydata[$k]['testkind']==$testtypekind)391 {392 $testkinddata[$m]['id']=$keydata[$k]['id'];393 $testkinddata[$m]['paper_name']=$keydata[$k]['paper_name'];394 $testkinddata[$m]['testid']=$keydata[$k]['testid'];395 $testkinddata[$m]['classidarr']=$keydata[$k]['classidarr'];396 $testkinddata[$m]['groupidarr']=$keydata[$k]['groupidarr'];397 $testkinddata[$m]['testtime']=$keydata[$k]['testtime'];398 $testkinddata[$m]['testkind']=$keydata[$k]['testkind'];399 $testkinddata[$m]['chapterarr']=$keydata[$k]['chapterarr'];400 $testkinddata[$m]['filesernum']=$keydata[$k]['filesernum'];401 $m=$m+1;402 }403 }404 }405 $count=sizeof($testkinddata);406 $m=0;407 if($testchapterarr!='')408 {409 for($k=0;$k<$count;$k++)410 {411 if(arraysub($testchapterarr,$testkinddata[$k]['chapterarr'])==1)412 {413 $chapterdata[$m]['id']=$testkinddata[$k]['id'];414 $chapterdata[$m]['paper_name']=$testkinddata[$k]['paper_name'];415 $chapterdata[$m]['testid']=$testkinddata[$k]['testid'];416 $chapterdata[$m]['classidarr']=$testkinddata[$k]['classidarr'];417 $chapterdata[$m]['groupidarr']=$testkinddata[$k]['groupidarr'];418 $chapterdata[$m]['testtime']=$testkinddata[$k]['testtime'];419 $chapterdata[$m]['testkind']=$testkinddata[$k]['testkind'];420 $chapterdata[$m]['chapterarr']=$testkinddata[$k]['chapterarr'];421 $chapterdata[$m]['filesernum']=$testkinddata[$k]['filesernum'];422 $m=$m+1;423 }424 }425 }426 //进行排重处理427 $chapterdata=uniquetestarray($chapterdata);428 $count=sizeof($chapterdata);429 $modelpublicdata=M('test_public_data');430 $m=0;431 for($i=0;$i<$count;$i++)432 {433 $filesernum=$chapterdata[$i]['filesernum'];434 $sernumarr['filesernum']=$filesernum;435 $sernumarr['ctbname'] = array('in','t-a,a');436 //这里完成图片或者连带标题标示,比如完形填空。437 $testdata=$modelpublicdata->where($sernumarr)->field('id,filesernum,typeid')->select();438 $test_count=sizeof($testdata);439 for($j=0;$j<$test_count;$j++)440 {441 if($typeid==$testdata[$j]['typeid'])442 {443 $testmsg[$m]['testname']=$chapterdata[$i]['paper_name'];444 $testmsg[$m]['testid']=$chapterdata[$i]['testid'];445 $testmsg[$m]['id']=$testdata[$j]['id'];446 $testmsg[$m]['filesernum']=$testdata[$j]['filesernum'];447 $testmsg[$m]['typeid']=$testdata[$j]['typeid'];448 $m=$m+1;449 }450 }451 }452 $data=uniquearray($testmsg);453// print_r($data);454//455// print_r($data);456 $count=sizeof($data);457 $beginnum=($nowpage-1)*$pagelength;458 $endnum=$beginnum+$pagelength;459 $m=0;460 for($i=0;$i<$count;$i++)461 {462 if($i>=$beginnum && $i<$endnum)463 {464 $outdata[$m]['id']=$data[$i]['id'];465 $outdata[$m]['testid']=$data[$i]['testid'];466 $outdata[$m]['testname']=$data[$i]['testname'];467 $outdata[$m]['filesernum']=$data[$i]['filesernum'];468 $outdata[$m]['typeid']=$data[$i]['typeid'];469 $outdata[$m]['num']=$beginnum;470 $beginnum=$beginnum+1;471 $m=$m+1;472 }473 }474 $outdata['count']=sizeof($outdata);475 $outdata['typeid']=$typeid;476 $outdata['nowpage']=$nowpage;477 $outdata['pagenum']=ceil($count/$pagelength);478 echo json_encode($outdata);479 //print_r($outdata);480 }481//单个习题的错题率统计482 public function test_question_statistic()483 {484 $question_id=1444;485 $classid=65;486 $kind='1';487 $question_model=M('question_statistic');488 $question_arr['question_id']=$question_id;489 $question_data=$question_model->where($question_arr)->select();490 $all_count=sizeof($question_data);491 $m=0;492 for($i=0;$i<$all_count;$i++)493 {494 $testidarr=explode(',',$question_data[$i]['testidarr']);495 $classidarr=explode(',',$question_data[$i]['classidarr']);496 $testtimearr=explode(',',$question_data[$i]['testtimearr']);497 $useridarr=explode(',',$question_data[$i]['useridarr']);498 $schoolidarr=explode(',',$question_data[$i]['schoolidarr']);499 $g1_w_num_arr=explode(',',$question_data[$i]['g1_w_num_arr']);500 $g2_w_num_arr=explode(',',$question_data[$i]['g2_w_num_arr']);501 $g3_w_num_arr=explode(',',$question_data[$i]['g3_w_num_arr']);502 $other_w_num_arr=explode(',',$question_data[$i]['other_w_num_arr']);503 $all_w_num_arr=explode(',',$question_data[$i]['all_w_num_arr']);504 $g1_sum_arr=explode(',',$question_data[$i]['g1_sum_arr']);505 $g2_sum_arr=explode(',',$question_data[$i]['g2_sum_arr']);506 $g3_sum_arr=explode(',',$question_data[$i]['g3_sum_arr']);507 $other_sum_arr=explode(',',$question_data[$i]['other_sum_arr']);508 $all_sum_arr=explode(',',$question_data[$i]['all_sum_arr']);509 $test_count=sizeof($testidarr);510 for($n=0;$n<$test_count;$n++)511 {512 $myclassidarr=explode('-',$classidarr[$n]);513 $testtimearr=explode('+',$testtimearr[$n]);514 $myg1_w_num_arr=explode('-',$g1_w_num_arr[$n]);515 $myg2_w_num_arr=explode('-',$g2_w_num_arr[$n]);516 $myg3_w_num_arr=explode('-',$g3_w_num_arr[$n]);517 $myother_w_num_arr=explode('-',$other_w_num_arr[$n]);518 $myall_w_num_arr=explode('-',$all_w_num_arr[$n]);519 $myg1_sum_arr=explode('-',$g1_sum_arr[$n]);520 $myg2_sum_arr=explode('-',$g2_sum_arr[$n]);521 $myg3_sum_arr=explode('-',$g3_sum_arr[$n]);522 $myother_sum_arr=explode('-',$other_sum_arr[$n]);523 $myall_sum_arr=explode('-',$all_sum_arr[$n]);524 $myclass_count=sizeof($myclassidarr);525 for($k=0;$k<$myclass_count;$k++)526 {527 $mynewdata[$m]['id']=$question_data[$i]['id'];528 $mynewdata[$m]['question_id']=$question_data[$i]['question_id'];529 $mynewdata[$m]['testid']=$testidarr[$n];530 $mynewdata[$m]['userid']=$useridarr[$n];531 $mynewdata[$m]['schoolid']=$schoolidarr[$n];532 $mynewdata[$m]['classid']=$myclassidarr[$k];533 $mynewdata[$m]['testtime']=$testtimearr[$k];534 $mynewdata[$m]['g1_w_num']=$myg1_w_num_arr[$k];535 $mynewdata[$m]['g2_w_num']=$myg2_w_num_arr[$k];536 $mynewdata[$m]['g3_w_num']=$myg3_w_num_arr[$k];537 $mynewdata[$m]['other_w_num']=$myother_w_num_arr[$k];538 $mynewdata[$m]['all_w_num']=$myall_w_num_arr[$k];539 $mynewdata[$m]['g1_sum']=$myg1_sum_arr[$k];540 $mynewdata[$m]['g2_sum']=$myg2_sum_arr[$k];541 $mynewdata[$m]['g3_sum']=$myg3_sum_arr[$k];542 $mynewdata[$m]['other_sum']=$myother_sum_arr[$k];543 $mynewdata[$m]['all_sum']=$myall_sum_arr[$k];544 $m=$m+1;545 }546 }547 }548 $class_count=sizeof($mynewdata);549 $m=0;550 for($a=0;$a<$class_count;$a++)551 {552 if($mynewdata[$a]['classid']==$classid)553 {554 $classdata[$m]['id']=$mynewdata[$a]['id'];555 $classdata[$m]['question_id']=$mynewdata[$a]['question_id'];556 $classdata[$m]['testid']=$mynewdata[$a]['testid'];557 $classdata[$m]['testtime']=$mynewdata[$a]['testtime'];558 $classdata[$m]['userid']=$mynewdata[$a]['userid'];559 $classdata[$m]['schoolid']=$mynewdata[$a]['schoolid'];560 $classdata[$m]['classid']=$mynewdata[$a]['classid'];561 $classdata[$m]['g1_w_num']=$mynewdata[$a]['g1_w_num'];562 $classdata[$m]['g2_w_num']=$mynewdata[$a]['g2_w_num'];563 $classdata[$m]['g3_w_num']=$mynewdata[$a]['g3_w_num'];564 $classdata[$m]['other_w_num']=$mynewdata[$a]['other_w_num'];565 $classdata[$m]['all_w_num']=$mynewdata[$a]['all_w_num'];566 $classdata[$m]['g1_sum']=$mynewdata[$a]['g1_sum'];567 $classdata[$m]['g2_sum']=$mynewdata[$a]['g2_sum'];568 $classdata[$m]['g3_sum']=$mynewdata[$a]['g3_sum'];569 $classdata[$m]['other_sum']=$mynewdata[$a]['other_sum'];570 $classdata[$m]['all_sum']=$mynewdata[$a]['all_sum'];571 $m=$m+1;572 }573 }574 $data=$classdata;575 $data['group']=$kind;576 $count=sizeof($classdata);577 $num1=$count-1;578 $num2=$count-2;579 $mydata['num']=$count;580 if($count>=2)581 {582 if($kind=='1')583 {584 $data['one']=round($data[$num1]['g1_w_num']/$data[$num1]['g1_sum']*100,2)."%";585 $data['two']=round($data[$num2]['g1_w_num']/$data[$num2]['g1_sum']*100,2)."%";586 $data['ratio']=($data['one']-$data['two']);587 $num=(int)$data['ratio'];588 if($num>0)589 {590 $data['ratio']='Down:'.$data['ratio'].'%';591 $data['kind']='Down';592 }593 if($num<0)594 {595 $data['ratio']='Up:'.$data['ratio']*(-1).'%';596 $data['kind']='Up';597 }598 if($num==0)599 {600 $data['ratio']='0';601 $data['kind']='0';602 }603 }604 if($kind=='2')605 {606 $data['one']=round($data[$num1]['g2_w_num']/$data[$num1]['g2_sum']*100,2)."%";607 $data['two']=round($data[$num2]['g2_w_num']/$data[$num2]['g2_sum']*100,2)."%";608 $data['ratio']=($data['one']-$data['two']);609 $num=(int)$data['ratio'];610 if($num>0)611 {612 $data['ratio']='Down:'.$data['ratio'].'%';613 $data['kind']='Down';614 }615 if($num<0)616 {617 $data['ratio']='Up:'.$data['ratio']*(-1).'%';618 $data['kind']='Up';619 }620 if($num==0)621 {622 $data['ratio']='0';623 $data['kind']='0';624 }625 }626 if($kind=='3')627 {628 $data['one']=round($data[$num1]['g3_w_num']/$data[$num1]['g3_sum']*100,2)."%";629 $data['two']=round($data[$num2]['g3_w_num']/$data[$num2]['g3_sum']*100,2)."%";630 $data['ratio']=($data['one']-$data['two']);631 $num=(int)$data['ratio'];632 if($num>0)633 {634 $data['ratio']='Down:'.$data['ratio'].'%';635 $data['kind']='Down';636 }637 if($num<0)638 {639 $data['ratio']='Up:'.$data['ratio']*(-1).'%';640 $data['kind']='Up';641 }642 if($num==0)643 {644 $data['ratio']='0';645 $data['kind']='0';646 }647 }648 if($kind=='4')649 {650 $data['one']=round($data[$num1]['other_w_num']/$data[$num1]['other_sum']*100,2)."%";651 $data['two']=round($data[$num2]['other_w_num']/$data[$num2]['other_sum']*100,2)."%";652 $data['ratio']=($data['one']-$data['two']);653 $num=(int)$data['ratio'];654 if($num>0)655 {656 $data['ratio']='Down:'.$data['ratio'].'%';657 }658 if($num<0)659 {660 $data['ratio']='Up:'.$data['ratio']*(-1).'%';661 }662 if($num==0)663 {664 $data['ratio']='0';665 }666 }667 if($kind=='5')668 {669 $data['one']=round($data[$num1]['all_w_num']/$data[$num1]['all_sum']*100,2)."%";670 $data['two']=round($data[$num2]['all_w_num']/$data[$num2]['all_sum']*100,2)."%";671 $data['ratio']=($data['one']-$data['two']);672 $num=(int)$data['ratio'];673 if($num>0)674 {675 $data['ratio']='Down:'.$data['ratio'].'%';676 }677 if($num<0)678 {679 $data['ratio']='Up:'.$data['ratio']*(-1).'%';680 }681 if($num==0)682 {683 $data['ratio']='0';684 }685 }686 }687 //计算到这里688 if($count==1)689 {690 $num=$count-1;691 if($kind=='g1') {692 $data['one'] = round($data[$num1]['g1_w_num'] / $data[$num]['g1_sum'] * 100, 2) . "%";693 $data['two'] = "-%";694 $data['ratio']='-%';695 }696 if($kind=='g2') {697 $data['one'] = round($data[$num1]['g2_w_num'] / $data[$num]['g2_sum'] * 100, 2) . "%";698 $data['two'] = "-%";699 $data['ratio']='-%';700 }701 if($kind=='g3') {702 $data['one'] = round($data[$num1]['g3_w_num'] / $data[$num]['g3_sum'] * 100, 2) . "%";703 $data['two'] = "-%";704 $data['ratio']='-%';705 }706 if($kind=='other') {707 $data['one'] = round($data[$num1]['other_w_num'] / $data[$num]['other_sum'] * 100, 2) . "%";708 $data['two'] = "-%";709 $data['ratio']='-%';710 }711 if($kind=='all') {712 $data['one'] = round($data[$num1]['all_w_num'] / $data[$num]['all_sum'] * 100, 2) . "%";713 $data['two'] = "-%";714 $data['ratio']='-%';715 }716 }717 if($count==0)718 {719 $staticdata['one'] = "-%";720 $data['two'] = "-%";721 $data['ratio']='-%';722 }723 print_r($data);724 }725 public function phpbindtestsub(){726 $id=$_POST['id'];727 $subjectid=$_POST['subjectid'];728 $typeid=$_POST['typeid'];729 $modelpapermsg=M('paper_msg_data');730 $modelpublicdata=M('test_public_data');731// $id=135;732// $subjectid=2;733// $typeid=20;734 $paperarr['userid']=$id;735 $paperarr['subjectid']=$subjectid;736 $paperdata=$modelpapermsg->where($paperarr)->select();737 $paper_count=sizeof($paperdata);738 $m=0;739 for($i=0;$i<$paper_count;$i++)740 {741 $filearr['filesernum']=$paperdata[$i]['filesernum'];742 $filearr['ctbname'] = array('in','t-a,a');743 $testdata=$modelpublicdata->where($filearr)->field('id,filesernum,typeid,pic1,pic2,pic3,pic4')->select();744 $test_count=sizeof($testdata);745 for($j=0;$j<$test_count;$j++)746 {747 $testmsg[$m]['testname']=$paperdata[$i]['paper_name'];748 $testmsg[$m]['testid']=$paperdata[$i]['id'];749 $testmsg[$m]['id']=$testdata[$j]['id'];750 $testmsg[$m]['filesernum']=$testdata[$j]['filesernum'];751 $testmsg[$m]['typeid']=$testdata[$j]['typeid'];752 $m=$m+1;753 }754 }755 $data=uniquearray($testmsg);756 $data['count']=sizeof($data);757 $data['typeid']=$typeid;758// print_r($data);759 echo json_encode($data);760 }761//绑定习题具体信息,没有用762// public function phpbindtestdetail1()763// {764// $testid=$_POST['testid'];765// $typeid=$_POST['typeid'];766//767// $groupid=$_POST['groupid'];768// $classid=$_POST['classid'];769//770// $model_paper=M('paper_msg_data');771// $model_public=M('test_public_data');772// $model_img=M('img_cuted_data');773//774// $paper_data=$model_paper->where('id='.$testid)->find();775// $filesernum=$paper_data['filesernum'];776// $arr['filesernum']=$filesernum;777// $arr['typeid']=$typeid;778// $arr['ctbname']=array('in','t-a,a');779// $public_data=$model_public->where($arr)->order('in_ser asc')->select();780// $count=sizeof($public_data);781//782// for($i=0;$i<$count;$i++)783// {784// $srcid=$public_data[$i]['srcid'];785// $src_data=$model_img->where('id='.$srcid)->find();786// $src=$src_data['src'];787// $newdata[$i]['srcid']=$srcid;788// $newdata[$i]['src']=appusersrc($src);789//790// $test_data=test_question_statistic($srcid,$classid,$groupid);791//792// $newdata[$i]['group']=$test_data['group'];793// $newdata[$i]['one']=$test_data['one'];794// $newdata[$i]['two']=$test_data['two'];795// $newdata[$i]['ratio']=$test_data['ratio'];796// $newdata[$i]['kind']=$test_data['kind'];797//798// }799//800// $newdata['count']=sizeof($newdata);801// $newdata['typeid']=$typeid;802//803// echo json_encode($newdata);804//805//806// }807//插入习题统计信息808 public function teststatic()809 {810 $testid=149;811 $groupidarr='g1-g2-g3';812 $classidarr='123-234-244';813 $testtime='2018-09-18';814 $testkind=2;815 $userid=135;816 $papername='测试试卷新';817 $subjectid=2;818 $filesernum='a1001201885224431';819 $keynote_msg='23,34,23';820 $schoolid=123;821 $gradeid=234;822 $model_test=M('test_statistic');823 $all_arr['userid']=$userid;824 $all_arr['subjectid']=$subjectid;825 $all_data=$model_test->where($all_arr)->field('id,testid,classidarr,groupidarr,testtime,testkind,chapterarr,paper_name,filesernum')->select();826 $all_count=sizeof($all_data);827 $m=0;828 for($i=0;$i<$all_count;$i++)829 {830 $classidarr=explode(',',$all_data[$i]['classidarr']);831 $groupidarr=explode(',',$all_data[$i]['groupidarr']);832 $testtime=explode(',',$all_data[$i]['testtime']);833 $testkind=explode(',',$all_data[$i]['testkind']);834 $chapterarr=explode(',',$all_data[$i]['chapterarr']);835 $class_count=sizeof($classidarr);836 for($n=0;$n<$class_count;$n++) {837 $inewdata[$m]['id'] = $all_data[$i]['id'];838 $inewdata[$m]['testid'] = $all_data[$i]['testid'];839 $inewdata[$m]['paper_name'] = $all_data[$i]['paper_name'];840 $inewdata[$m]['filesernum'] = $all_data[$i]['filesernum'];841 $inewdata[$m]['testtime'] = $testtime[$n];842 $inewdata[$m]['testkind'] = $testkind[$n];843 $inewdata[$m]['chapterarr'] = $chapterarr[$n];844 $inewdata[$m]['classidarr'] = '-' . $classidarr[$n] . '-';845 $inewdata[$m]['groupidarr'] = '-' . $groupidarr[$n] . '-';846 $m = $m + 1;847 }848 }849 $addgroupid=explode('-',$groupidarr);850 $addgroupid_count=sizeof($addgroupid);851 $m=0;852 for($d=0;$d<$addgroupid_count;$d++)853 {854 $adddata[$m]['testid']=$testid;855 $adddata[$m]['classid']=$classidarr;856 $adddata[$m]['groupid']=$addgroupid[$d];857 $adddata[$m]['testtime']=$testtime;858 $m=$m+1;859 opertestsub($testid,$testtime,$classidarr,$addgroupid[$d],$papername,$testkind,$subjectid,$userid,$filesernum,$keynote_msg,$schoolid,$gradeid,$inewdata);860 }861 }862//插入习题统计信息,正式使用的时候进行完善863 public function test()864 {865 $question_id='1443,1444,110';866 $testidarr=150;867 $classidarr=12;868 $userid=136;869 $stuid=136;870 $testid=151;871 $testid=1520;872 $testtime='2018-09-20';873 $myclassid=65;874 $question_id=1443;875 $testkind='';876 $operkind=1;877 $question_model=M('question_statistic_new');878 $question_arr=explode(',',$question_id);879 $myquestion_count=sizeof($question_arr);880 //需要根据习题进行循环881// for($i=0;$i<$myquestion_count;$i++)882// {883//884// }885 $myarr['question_id']=$question_id;886 $question_data=$question_model->where($myarr)->select();887 $count=sizeof($question_data);888 print_r($question_data);889 if($count==0)890 {891 $testkind='add';892 }893 else894 {895 $testkind='update';896 }897 if($testkind=='update')898 {899 $testidarr=explode(',',$question_data[0]['testidarr']);900 $classidarr=explode(',',$question_data[0]['classidarr']);901 $g1_w_num_arr=explode(',',$question_data[0]['g1_w_num_arr']);902 $g2_w_num_arr=explode(',',$question_data[0]['g2_w_num_arr']);903 $g3_w_num_arr=explode(',',$question_data[0]['g3_w_num_arr']);904 $other_w_num_arr=explode(',',$question_data[0]['other_w_num_arr']);905 $g1_sum_arr=explode(',',$question_data[0]['g1_sum_arr']);906 $g2_sum_arr=explode(',',$question_data[0]['g2_sum_arr']);907 $g3_sum_arr=explode(',',$question_data[0]['g3_sum_arr']);908 $other_sum_arr=explode(',',$question_data[0]['other_sum_arr']);909 $all_sum_arr=explode(',',$question_data[0]['all_sum_arr']);910 $testtimearr=explode(',',$question_data[0]['testtimearr']);911 $useridarr=explode(',',$question_data[0]['useridarr']);912 $schoolidarr=explode(',',$question_data[0]['schoolidarr']);913 $onlyquestionarr['question_id']=$question_id;914 $testcount=sizeof($testidarr);915 //第一次扒皮,分解出来,习题中的每个考试数据916 $m=0;917 for($k=0;$k<$testcount;$k++)918 {919 $questiontestarr[$k]['question_id']=$question_id;920 $questiontestarr[$k]['testid']=$testidarr[$k];921 $testdata[$m]['question_id']=$question_id;922 $testdata[$m]['testid']=$testidarr[$k];923 $testdata[$m]['classidarr']=$classidarr[$k];924 $testdata[$m]['g1_w_num']=$g1_w_num_arr[$k];925 $testdata[$m]['g2_w_num']=$g2_w_num_arr[$k];926 $testdata[$m]['g3_w_num']=$g3_w_num_arr[$k];927 $testdata[$m]['other_w_num']=$other_w_num_arr[$k];928 $testdata[$m]['g1_sum_num']=$g1_sum_arr[$k];929 $testdata[$m]['g2_sum_num']=$g2_sum_arr[$k];930 $testdata[$m]['g3_sum_num']=$g3_sum_arr[$k];931 $testdata[$m]['other_sum_num']=$other_sum_arr[$k];932 $testdata[$m]['all_sum_arr']=$all_sum_arr[$k];933 $testdata[$m]['testtimearr']=$testtimearr[$k];934 $testdata[$m]['useridarr']=$useridarr[$k];935 $testdata[$m]['schoolidarr']=$schoolidarr[$k];936 $m=$m+1;937 }938 $m=0;939 $i=0;940 //第二次扒皮,每个试题所在的试卷,所对应的班级及其数据941 for($k=0;$k<$testcount;$k++)942 {943 $classid=explode('-',$classidarr[$k]);944 $g1_w_num=explode('-',$g1_w_num_arr[$k]);945 $g2_w_num=explode('-',$g2_w_num_arr[$k]);946 $g3_w_num=explode('-',$g3_w_num_arr[$k]);947 $other_w_num=explode('-',$other_w_num_arr[$k]);948 $g1_sum=explode('-',$g1_sum_arr[$k]);949 $g2_sum=explode('-',$g2_sum_arr[$k]);950 $g3_sum=explode('-',$g3_sum_arr[$k]);951 $other_sum=explode('-',$other_sum_arr[$k]);952 $all_sum=explode('-',$all_sum_arr[$k]);953 $testtime=explode('+',$testtimearr[$k]);954 $class_count=sizeof($classid);955 $onlytestid[$i]=$testidarr[$k];956 $i=$i+1;957 for($a=0;$a<$class_count;$a++)958 {959 $testclassdata[$m]['question_id']=$question_id;960 $testclassdata[$m]['testid']=$testidarr[$k];961 $testclassdata[$m]['useridarr']=$useridarr[$k];962 $testclassdata[$m]['schoolidarr']=$schoolidarr[$k];963 $testclassdata[$m]['classid']=$classid[$a];964 $testclassdata[$m]['g1_w_num']=$g1_w_num[$a];965 $testclassdata[$m]['g2_w_num']=$g2_w_num[$a];966 $testclassdata[$m]['g3_w_num']=$g3_w_num[$a];967 $testclassdata[$m]['other_w_num']=$other_w_num[$a];968 $testclassdata[$m]['g1_sum']=$g1_sum[$a];969 $testclassdata[$m]['g2_sum']=$g2_sum[$a];970 $testclassdata[$m]['g3_sum']=$g3_sum[$a];971 $testclassdata[$m]['other_sum']=$other_sum[$a];972 $testclassdata[$m]['all_sum']=$all_sum[$a];973 $testclassdata[$m]['testtime']=$testtime[$a];974 $m=$m+1;975 }976 }977 $testclass_count=sizeof($testclassdata);978 $questiongroupkind=0;979 $questionclassnotekind=0;980 $questiontimenotekind=0;981 $questiontimeclassnotekind=0;982 for($i=0;$i<$testclass_count;$i++)983 {984 if( $testclassdata[$i]['testid']==$testid && $testclassdata[$i]['classid']==$myclassid && $testclassdata[$i]['testtime']==$testtime)985 {986 $questiongroupkind=1;987 }988 if($testclassdata[$i]['testid']==$testid && $testclassdata[$i]['testtime']==$testtime && $testclassdata[$i]['classid']!=$myclassid)989 {990 $questionclassnotekind=1;991 }992 if($testclassdata[$i]['testid']==$testid && $testclassdata[$i]['classid']==$myclassid && $testclassdata[$i]['testtime']!=$testtime )993 {994 $questiontimenotekind=1;995 }996 if($testclassdata[$i]['testid']==$testid && $testclassdata[$i]['classid']!=$myclassid && $testclassdata[$i]['testtime']!=$testtime )997 {998 $questiontimeclassnotekind=1;999 }1000 }1001 if($questiongroupkind==1)1002 {1003 $updatequestionkind='updategroup';1004 }1005 else1006 {1007 if($questiontimenotekind==1)1008 {1009 $updatequestionkind='addtimenote';1010 }1011 else1012 {1013 if($questionclassnotekind==1)1014 {1015 $updatequestionkind='addclassnote';1016 }1017 else1018 {1019 if($questiontimeclassnotekind==1)1020 {1021 $updatequestionkind='addtimeclassnote';1022 }1023 else1024 {1025 $updatequestionkind='addtest';1026 }1027 }1028 }1029 }1030 }1031 $model_user=M('user_data');1032 $model_user_add=M('user_studentparent_addation_data');1033 $model_group=M('group_data');1034 $model_class=M('class_data');1035 $model_paper=M('paper_msg_data');1036 $user_data=$model_user->where('id='.$stuid)->find();1037 $user_add_data=$model_user_add->where('userid='.$stuid)->find();1038 $groupid=$user_add_data['groupid'];1039 $groupdata=$model_group->where('id='.$groupid)->find();1040 $groupmsg=$groupdata['groupname'];1041 $myclassid=$user_add_data['classid'];1042 $class_data=$model_class->where('id='.$myclassid)->find();1043 $g1sum=$class_data['g1_sum'];1044 $g2sum=$class_data['g2_sum'];1045 $g3sum=$class_data['g3_sum'];1046 $othersum=$class_data['other_sum'];1047 $allsum=$class_data['classnum'];1048 $schoolid=$class_data['school_id'];1049 $paper_data=$model_paper->where('id='.$testid)->find();1050 $testtime=$paper_data['publish_time'];1051 $userid=$paper_data['userid'];1052 $userid=123;1053 $testtime='2018-09-12';1054 // print_r($paper_data);1055 if($testkind=='add')1056 {1057 $questionarr['question_id']=$question_id;1058 $questionarr['testidarr']=$testid;1059 $questionarr['classidarr']=$myclassid;1060 $questionarr['g1_w_num_arr']=0;1061 $questionarr['g2_w_num_arr']=0;1062 $questionarr['g3_w_num_arr']=0;1063 $questionarr['other_w_num_arr']=0;1064 $questionarr['all_w_num_arr']=1;1065 if($groupmsg=='g1')1066 {1067 $questionarr['g1_w_num_arr']=1;1068 }1069 if($groupmsg=='g2')1070 {1071 $questionarr['g2_w_num_arr']=1;1072 }1073 if($groupmsg=='g3')1074 {1075 $questionarr['g3_w_num_arr']=1;1076 }1077 if($groupmsg=='other')1078 {1079 $questionarr['other_w_num_arr']=1;1080 }1081 $questionarr['all_w_num_arr']=1;1082 $questionarr['g1_sum_arr']=$g1sum;1083 $questionarr['g2_sum_arr']=$g2sum;1084 $questionarr['g3_sum_arr']=$g3sum;1085 $questionarr['other_sum_arr']=$othersum;1086 $questionarr['all_sum_arr']=$allsum;1087 $questionarr['testtimearr']=$testtime;1088 $questionarr['useridarr']=$userid;1089 $questionarr['schoolidarr']=$schoolid;1090 $question_model->add($questionarr);1091 }1092 if($testkind=='update') {1093 if($updatequestionkind=='updategroup')1094 {1095 for($m=0;$m<$testclass_count;$m++)1096 {1097 if( $testclassdata[$m]['testid']==$testid && $testclassdata[$m]['classid']==$myclassid && $testclassdata[$m]['testtime']==$testtime)1098 {1099 if($operkind==1)1100 {1101 if($groupmsg=='g1')1102 {1103 $testclassdata[$m]['g1_w_num']=$testclassdata[$m]['g1_w_num']+1;1104 }1105 if($groupmsg=='g2')1106 {1107 $testclassdata[$m]['g2_w_num']=$testclassdata[$m]['g2_w_num']+1;1108 }1109 if($groupmsg=='g3')1110 {1111 $testclassdata[$m]['g3_w_num']=$testclassdata[$m]['g3_w_num']+1;1112 }1113 if($groupmsg=='other')1114 {1115 $testclassdata[$m]['other_w_num']=$testclassdata[$m]['other_w_num']+1;1116 }1117 $testclassdata[$m]['all_w_num_arr']=$testclassdata[$m]['all_w_num_arr']+1;1118 }1119 else1120 {1121 if($groupmsg=='g1')1122 {1123 $testclassdata[$m]['g1_w_num']=$testclassdata[$m]['g1_w_num']-1;1124 }1125 if($groupmsg=='g2')1126 {1127 $testclassdata[$m]['g2_w_num']=$testclassdata[$m]['g2_w_num']-1;1128 }1129 if($groupmsg=='g3')1130 {1131 $testclassdata[$m]['g3_w_num']=$testclassdata[$m]['g3_w_num']-1;1132 }1133 if($groupmsg=='other')1134 {1135 $testclassdata[$m]['other_w_num']=$testclassdata[$m]['other_w_num']-1;1136 }1137 $testclassdata[$m]['all_w_num_arr']=$testclassdata[$m]['all_w_num_arr']-1;1138 }1139 }1140 }1141 }1142 print_r($testclassdata);1143 if($updatequestionkind=='addtimeclassnote' || $updatequestionkind=='addclassnote' || $updatequestionkind=='addtimenote')1144 {1145 if($operkind==1)1146 {1147 $testclassdata[$testclass_count]['question_id']=$question_id;1148 $testclassdata[$testclass_count]['testid']=$testid;1149 $testclassdata[$testclass_count]['useridarr']=$userid;1150 $testclassdata[$testclass_count]['schoolidarr']=$schoolid;1151 $testclassdata[$testclass_count]['classid']=$myclassid;1152 if($groupmsg=='g1')1153 {1154 $testclassdata[$testclass_count]['g1_w_num']='1';1155 $testclassdata[$testclass_count]['g2_w_num']='0';1156 $testclassdata[$testclass_count]['g3_w_num']='0';1157 $testclassdata[$testclass_count]['other_w_num']='0';1158 }1159 if($groupmsg=='g2')1160 {1161 $testclassdata[$testclass_count]['g1_w_num']='0';1162 $testclassdata[$testclass_count]['g2_w_num']='1';1163 $testclassdata[$testclass_count]['g3_w_num']='0';1164 $testclassdata[$testclass_count]['other_w_num']='0';1165 }1166 if($groupmsg=='g3')1167 {1168 $testclassdata[$testclass_count]['g1_w_num']='0';1169 $testclassdata[$testclass_count]['g2_w_num']='0';1170 $testclassdata[$testclass_count]['g3_w_num']='1';1171 $testclassdata[$testclass_count]['other_w_num']='0';1172 }1173 if($groupmsg=='other')1174 {1175 $testclassdata[$testclass_count]['g1_w_num']='0';1176 $testclassdata[$testclass_count]['g2_w_num']='0';1177 $testclassdata[$testclass_count]['g3_w_num']='0';1178 $testclassdata[$testclass_count]['other_w_num']='1';1179 }1180 $testclassdata[$testclass_count]['all_w_num']=1;1181 $testclassdata[$testclass_count]['g1_sum']=$g1sum;1182 $testclassdata[$testclass_count]['g2_sum']=$g2sum;1183 $testclassdata[$testclass_count]['g3_sum']=$g3sum;1184 $testclassdata[$testclass_count]['other_sum']=$othersum;1185 $testclassdata[$testclass_count]['all_sum']=$allsum;1186 $testclassdata[$testclass_count]['testtime']=$testtime;1187 $testclass_count=$testclass_count+1;1188 }1189 }1190 if($updatequestionkind=='addtest')1191 {1192 // echo 234;1193 if($operkind==1)1194 {1195 $testclassdata[$testclass_count]['question_id']=$question_id;1196 $testclassdata[$testclass_count]['testid']=$testid;1197 $testclassdata[$testclass_count]['useridarr']=$userid;1198 $testclassdata[$testclass_count]['schoolidarr']=$schoolid;1199 $testclassdata[$testclass_count]['classid']=$myclassid;1200 if($groupmsg=='g1')1201 {1202 $testclassdata[$testclass_count]['g1_w_num']='1';1203 $testclassdata[$testclass_count]['g2_w_num']='0';1204 $testclassdata[$testclass_count]['g3_w_num']='0';1205 $testclassdata[$testclass_count]['other_w_num']='0';1206 }1207 if($groupmsg=='g2')1208 {1209 $testclassdata[$testclass_count]['g1_w_num']='0';1210 $testclassdata[$testclass_count]['g2_w_num']='1';1211 $testclassdata[$testclass_count]['g3_w_num']='0';1212 $testclassdata[$testclass_count]['other_w_num']='0';1213 }1214 if($groupmsg=='g3')1215 {1216 $testclassdata[$testclass_count]['g1_w_num']='0';1217 $testclassdata[$testclass_count]['g2_w_num']='0';1218 $testclassdata[$testclass_count]['g3_w_num']='1';1219 $testclassdata[$testclass_count]['other_w_num']='0';1220 }1221 if($groupmsg=='other')1222 {1223 $testclassdata[$testclass_count]['g1_w_num']='0';1224 $testclassdata[$testclass_count]['g2_w_num']='0';1225 $testclassdata[$testclass_count]['g3_w_num']='0';1226 $testclassdata[$testclass_count]['other_w_num']='1';1227 }1228 $testclassdata[$testclass_count]['all_w_num']=1;1229 $testclassdata[$testclass_count]['g1_sum']=$g1sum;1230 $testclassdata[$testclass_count]['g2_sum']=$g2sum;1231 $testclassdata[$testclass_count]['g3_sum']=$g3sum;1232 $testclassdata[$testclass_count]['other_sum']=$othersum;1233 $testclassdata[$testclass_count]['all_sum']=$allsum;1234 $testclassdata[$testclass_count]['testtime']=$testtime;1235 $testclass_count=$testclass_count+1;1236 }1237// $count=sizeof($onlyquestionarr);1238//1239// $onlyquestionarr[$count]['question_id']=$question_id;1240 $count=sizeof($questiontestarr);1241 $questiontestarr[$count]['question_id']=$question_id;1242 $questiontestarr[$count]['testid']=$testid;1243 }1244 }1245 $questiontest_size=sizeof($questiontestarr);1246 $all_count=sizeof($testclassdata);1247 echo $questiontest_size;1248 for($m=0;$m<$questiontest_size;$m++)1249 {1250 for($n=0;$n<$all_count;$n++)1251 {1252 if($questiontestarr[$m]['question_id']==$testclassdata[$n]['question_id'] && $questiontestarr[$m]['testid']==$testclassdata[$n]['testid'])1253 {1254 $questiontestarr[$m]['useridarr']=$testclassdata[$n]['useridarr'];1255 $questiontestarr[$m]['schoolidarr']=$testclassdata[$n]['schoolidarr'];1256 $questiontestarr[$m]['classid']=$questiontestarr[$m]['classid'].'-'.$testclassdata[$n]['classid'];1257 $questiontestarr[$m]['g1_w_num']=$questiontestarr[$m]['g1_w_num'].'-'.$testclassdata[$n]['g1_w_num'];1258 $questiontestarr[$m]['g2_w_num']=$questiontestarr[$m]['g2_w_num'].'-'.$testclassdata[$n]['g2_w_num'];1259 $questiontestarr[$m]['g3_w_num']=$questiontestarr[$m]['g3_w_num'].'-'.$testclassdata[$n]['g3_w_num'];1260 $questiontestarr[$m]['other_w_num']=$questiontestarr[$m]['other_w_num'].'-'.$testclassdata[$n]['other_w_num'];1261 $questiontestarr[$m]['g1_sum']=$questiontestarr[$m]['g1_sum'].'-'.$testclassdata[$n]['g1_sum'];1262 $questiontestarr[$m]['g2_sum']=$questiontestarr[$m]['g2_sum'].'-'.$testclassdata[$n]['g2_sum'];1263 $questiontestarr[$m]['g3_sum']=$questiontestarr[$m]['g3_sum'].'-'.$testclassdata[$n]['g3_sum'];1264 $questiontestarr[$m]['all_sum']=$questiontestarr[$m]['all_sum'].'-'.$testclassdata[$n]['all_sum'];1265 $questiontestarr[$m]['testtime']=$questiontestarr[$m]['testtime'].'+'.$testclassdata[$n]['testtime'];1266 }1267 }1268 $questiontestarr[$m]['classid']=substr($questiontestarr[$m]['classid'],1);1269 $questiontestarr[$m]['g1_w_num']=substr($questiontestarr[$m]['g1_w_num'],1);1270 $questiontestarr[$m]['g2_w_num']=substr($questiontestarr[$m]['g2_w_num'],1);1271 $questiontestarr[$m]['g3_w_num']=substr($questiontestarr[$m]['g3_w_num'],1);1272 $questiontestarr[$m]['other_w_num']=substr($questiontestarr[$m]['other_w_num'],1);1273 $questiontestarr[$m]['g1_sum']=substr($questiontestarr[$m]['g1_sum'],1);1274 $questiontestarr[$m]['g2_sum']=substr($questiontestarr[$m]['g2_sum'],1);1275 $questiontestarr[$m]['g3_sum']=substr($questiontestarr[$m]['g3_sum'],1);1276 $questiontestarr[$m]['all_sum']=substr($questiontestarr[$m]['all_sum'],1);1277 $questiontestarr[$m]['testtime']=substr($questiontestarr[$m]['testtime'],1);1278 }1279 print_r($questiontestarr);1280 $count=sizeof($questiontestarr);1281 for($n=0;$n<$count;$n++)1282 {1283 $questiontestarr['question_id']=$questiontestarr[$n]['question_id'];1284 $questiontestarr['testid']=$questiontestarr['testid'].','.$questiontestarr[$n]['testid'];1285 $questiontestarr['schoolidarr']=$questiontestarr['schoolidarr'].','.$questiontestarr[$n]['schoolidarr'];1286 $questiontestarr['useridarr']=$testclassdata['useridarr'].','.$questiontestarr[$n]['useridarr'];1287 $questiontestarr['classid']=$questiontestarr['classid'].','.$questiontestarr[$n]['classid'];1288 $questiontestarr['g1_w_num']=$questiontestarr['g1_w_num'].','.$questiontestarr[$n]['g1_w_num'];1289 $questiontestarr['g2_w_num']=$questiontestarr['g2_w_num'].','.$questiontestarr[$n]['g2_w_num'];1290 $questiontestarr['g3_w_num']=$questiontestarr['g3_w_num'].','.$questiontestarr[$n]['g3_w_num'];1291 $questiontestarr['other_w_num']=$questiontestarr['other_w_num'].','.$questiontestarr[$n]['other_w_num'];1292 $questiontestarr['g1_sum']=$questiontestarr['g1_sum'].','.$questiontestarr[$n]['g1_sum'];1293 $questiontestarr['g2_sum']=$questiontestarr['g2_sum'].','.$questiontestarr[$n]['g2_sum'];1294 $questiontestarr['g3_sum']=$questiontestarr['g3_sum'].','.$questiontestarr[$n]['g3_sum'];1295 $questiontestarr['all_sum']=$questiontestarr['all_sum'].','.$questiontestarr[$n]['all_sum'];1296 $questiontestarr['testtime']=$questiontestarr['testtime'].','.$questiontestarr[$n]['testtime'];1297 }1298//1299 $questiontestarr['testid']=substr($questiontestarr['testid'],1);1300 $questiontestarr['schoolidarr']=substr($questiontestarr['schoolidarr'],1);1301 $questiontestarr['useridarr']=substr($questiontestarr['useridarr'],1);1302 $questiontestarr['classid']=substr($questiontestarr['classid'],1);1303 $questiontestarr['g1_w_num']=substr($questiontestarr['g1_w_num'],1);1304 $questiontestarr['g2_w_num']=substr($questiontestarr['g2_w_num'],1);1305 $questiontestarr['g3_w_num']=substr($questiontestarr['g3_w_num'],1);1306 $questiontestarr['other_w_num']=substr($questiontestarr['other_w_num'],1);1307 $questiontestarr['g1_sum']=substr($questiontestarr['g1_sum'],1);1308 $questiontestarr['g2_sum']=substr($questiontestarr['g2_sum'],1);1309 $questiontestarr['g3_sum']=substr($questiontestarr['g3_sum'],1);1310 $questiontestarr['all_sum']=substr($questiontestarr['all_sum'],1);1311 $questiontestarr['testtime']=substr($questiontestarr['testtime'],1);1312 //差更新数据库,加上就行。单个循环,要等到正式对接的时候在添加1313 }1314 public function test1()1315 {1316 $classid='-12-13-14';1317 echo substr($classid,1);1318 }1319 //绑定习题具体信息1320 public function phpbindtestdetail()1321 {1322 $testid=$_POST['testid'];1323 $typeid=$_POST['typeid'];1324 $groupid=$_POST['groupid'];1325 $classid=$_POST['classid'];1326 $no1ration=$_POST['no1ration'];1327 $no2ration=$_POST['no2ration'];1328 $no1testtime=$_POST['no1testtime'];1329 $no2testtime=$_POST['no2testtime'];1330 $questionorder=$_POST['questionorder'];1331// $testid=1523;1332// $typeid=20;1333// $classid=65;1334// $groupid=1;1335// $questionorder=2;1336// $no1testtime='';1337// $no2testtime='';1338 $model_paper=M('paper_msg_data');1339 $model_public=M('test_public_data');1340 $model_img=M('img_cuted_data');1341 $paper_data=$model_paper->where('id='.$testid)->find();1342 $filesernum=$paper_data['filesernum'];1343 $arr['filesernum']=$filesernum;1344 $arr['typeid']=$typeid;1345 $arr['ctbname']=array('in','t-a,a');1346 $public_data=$model_public->where($arr)->order('in_ser asc')->select();1347 $count=sizeof($public_data);1348 for($i=0;$i<$count;$i++)1349 {1350 $srcid=$public_data[$i]['srcid'];1351 $pic1=$public_data[$i]['pic1'];1352 $pic2=$public_data[$i]['pic2'];1353 $pic3=$public_data[$i]['pic3'];1354 $pic4=$public_data[$i]['pic4'];1355 $tsernum=$public_data[$i]['tsernum'];1356 if($tsernum>0)1357 {1358 $tsernumarr['tsernum']=$tsernum;1359 $tsernumarr['ctbname']='t1';1360 $tsernum_data=$model_public->where($tsernumarr)->find();1361 $t1_img_id=$tsernum_data['srcid'];1362 $t1_data=$model_img->where('id='.$t1_img_id)->find();1363 $t1_src=$t1_data['src'];1364 $newdata[$i]['t1_id']=$t1_img_id;1365 $newdata[$i]['t1_width']=getimagesize($t1_data['src'])[0];1366 $newdata[$i]['t1_height']=getimagesize($t1_data['src'])[1];1367 $newdata[$i]['t1_src']=appusersrc($t1_data['src']);1368 $newdata[$i]['t1_sernum']=$tsernum;1369 }1370 else1371 {1372 $newdata[$i]['t1_width']=0;1373 $newdata[$i]['t1_height']=0;1374 $newdata[$i]['t1_src']=0;1375 $newdata[$i]['t1_sernum']=0;1376 $newdata[$i]['t1_id']=0;1377 }1378 $src_data=$model_img->where('id='.$srcid)->find();1379 $src=$src_data['src'];1380 $pic_src_data=$model_img->where('id='.$pic1)->find();1381 $newdata[$i]['pic1_width']=getimagesize($pic_src_data['src'])[0];1382 $newdata[$i]['pic1_height']=getimagesize($pic_src_data['src'])[1];1383 $newdata[$i]['pic1_src']=appusersrc($pic_src_data['src']);1384 $newdata[$i]['pic1_id']=$pic1;1385 if($newdata[$i]['pic1_width']=='')1386 {1387 $newdata[$i]['pic1_width']='0';1388 }1389 if($newdata[$i]['pic1_height']=='')1390 {1391 $newdata[$i]['pic1_height']='0';1392 }1393 if($newdata[$i]['pic1_src']=='')1394 {1395 $newdata[$i]['pic1_src']='0';1396 }1397 $pic_src_data=$model_img->where('id='.$pic2)->find();1398 $newdata[$i]['pic2_width']=getimagesize($pic_src_data['src'])[0];1399 $newdata[$i]['pic2_height']=getimagesize($pic_src_data['src'])[1];1400 $newdata[$i]['pic2_src']=appusersrc($pic_src_data['src']);1401 $newdata[$i]['pic2_id']=$pic2;1402 if($newdata[$i]['pic2_width']=='')1403 {1404 $newdata[$i]['pic2_width']='0';1405 }1406 if($newdata[$i]['pic2_height']=='')1407 {1408 $newdata[$i]['pic2_height']='0';1409 }1410 if($newdata[$i]['pic2_src']=='')1411 {1412 $newdata[$i]['pic2_src']='0';1413 }1414 $pic_src_data=$model_img->where('id='.$pic3)->find();1415 $newdata[$i]['pic3_width']=getimagesize($pic_src_data['src'])[0];1416 $newdata[$i]['pic3_height']=getimagesize($pic_src_data['src'])[1];1417 $newdata[$i]['pic3_src']=appusersrc($pic_src_data['src']);1418 $newdata[$i]['pic3_id']=$pic3;1419 if($newdata[$i]['pic3_width']=='')1420 {1421 $newdata[$i]['pic3_width']='0';1422 }1423 if($newdata[$i]['pic3_height']=='')1424 {1425 $newdata[$i]['pic3_height']='0';1426 }1427 if($newdata[$i]['pic3_src']=='')1428 {1429 $newdata[$i]['pic3_src']='0';1430 }1431 $pic_src_data=$model_img->where('id='.$pic4)->find();1432 $newdata[$i]['pic4_width']=getimagesize($pic_src_data['src'])[0];1433 $newdata[$i]['pic4_height']=getimagesize($pic_src_data['src'])[1];1434 $newdata[$i]['pic4_src']=appusersrc($pic_src_data['src']);1435 $newdata[$i]['pic4_id']=$pic4;1436 if($newdata[$i]['pic4_width']=='')1437 {1438 $newdata[$i]['pic4_width']='0';1439 }1440 if($newdata[$i]['pic4_height']=='')1441 {1442 $newdata[$i]['pic4_height']='0';1443 }1444 if($newdata[$i]['pic4_src']=='')1445 {1446 $newdata[$i]['pic4_src']='0';1447 }1448 if($pic1=='')1449 {1450 $pic1='0';1451 $newdata[$i]['pic1_id']='0';1452 }1453 if($pic2=='')1454 {1455 $pic2='0';1456 $newdata[$i]['pic2_id']='0';1457 }1458 if($pic3=='')1459 {1460 $pic3='0';1461 $newdata[$i]['pic3_id']='0';1462 }1463 if($pic4=='')1464 {1465 $pic4='0';1466 $newdata[$i]['pic4_id']='0';1467 }1468 $newdata[$i]['pic1']=$pic1;1469 $newdata[$i]['pic2']=$pic2;1470 $newdata[$i]['pic3']=$pic3;1471 $newdata[$i]['pic4']=$pic4;1472 $pnum=0;1473 if($pic1>0)1474 {1475 $pnum=$pnum+1;1476 }1477 if($pic2>0)1478 {1479 $pnum=$pnum+1;1480 }1481 if($pic3>0)1482 {1483 $pnum=$pnum+1;1484 }1485 if($pic4>0)1486 {1487 $pnum=$pnum+1;1488 }1489 $newdata[$i]['srcid']=$srcid;1490 $newdata[$i]['src']=appusersrc($src);1491 $newdata[$i]['answerid']=$src_data['answerid'];1492 $newdata[$i]['picsum']=$pnum;1493 $answer_data=$model_img->where('id='.$src_data['answerid'])->find();1494 $newdata[$i]['answersrc']=usersrc($answer_data['src']);1495 $newdata[$i]['width']=getimagesize($answer_data['src'])[0];1496 $newdata[$i]['height']=getimagesize($answer_data['src'])[1];1497 if($newdata[$i]['answersrc']=='')1498 {1499 $newdata[$i]['answersrc']='0';1500 $newdata[$i]['width']='0';1501 $newdata[$i]['height']='0';1502 }1503 $test_data=test_question_statistic($srcid,$classid,$groupid);1504 $newdata[$i]['group']=$test_data['group'];1505 $newdata[$i]['one']=$test_data['one'];1506 $newdata[$i]['two']=$test_data['two'];1507 $newdata[$i]['ratio']=$test_data['ratio'];1508 $newdata[$i]['kind']=$test_data['kind'];1509 $newdata[$i]['sum']=$test_data['sum'];1510 $newdata[$i]['classid']=$test_data['classid'];1511 $newdata[$i]['ctone']=str_replace("%","",$test_data['one']);1512 }1513 $newdata = seekarr($newdata,'ctone',$no1ration,$no2ration);1514 $newdata = seekarr($newdata,'sum',$no1testtime,$no2testtime);1515 if($questionorder==1)1516 {1517 $newdata=array_sort($newdata,'ctone',1);1518 }1519 if($questionorder==2)1520 {1521 $newdata=array_sort($newdata,'ctone',0);1522 }1523 if($questionorder==3)1524 {1525 $newdata=array_sort($newdata,'sum',1);1526 }1527 if($questionorder==4)1528 {1529 $newdata=array_sort($newdata,'sum',0);1530 }1531 $newdata=array_values($newdata);1532 $newdata['count']=sizeof($newdata);1533 $newdata['typeid']=$typeid;1534 $newdata['testid']=$testid;1535 echo json_encode($newdata);1536 }1537 public function phpchooseimgsub()1538 {1539 $src=$_POST['src'];1540 $ratio=$_POST['ratio'];1541 $typeid=$_POST['typeid'];1542 $premsg=$_POST['premsg'];1543 $picmsg=explode(',',$_POST['picmsg']);1544 $tsermsg=explode(',',$_POST['tsermsg']);1545 $newdata['t1_sernum']=$tsermsg[0];1546 $newdata['t1_src']=$tsermsg[1];1547 $newdata['t1_width']=round($tsermsg[2]*$ratio);1548 $newdata['t1_height']=round($tsermsg[3]*$ratio);1549 $newdata['picsum']=$picmsg[0];1550 $newdata['pic1_src']=$picmsg[1];1551 $newdata['pic1_width']=round($picmsg[2]*$ratio);1552 $newdata['pic1_height']=round($picmsg[3]*$ratio);1553 $newdata['pic2_src']=$picmsg[4];1554 $newdata['pic2_width']=round($picmsg[5]*$ratio);1555 $newdata['pic2_height']=round($picmsg[6]*$ratio);1556 $newdata['pic3_src']=$picmsg[7];1557 $newdata['pic3_width']=round($picmsg[8]*$ratio);1558 $newdata['pic3_height']=round($picmsg[9]*$ratio);1559 $newdata['pic4_src']=$picmsg[10];1560 $newdata['pic4_width']=round($picmsg[11]*$ratio);1561 $newdata['pic4_height']=round($picmsg[12]*$ratio);1562 $newsrc='.'.$src;1563 $arr = getimagesize($newsrc);1564 $newdata['width']=round($arr[0]*$ratio);1565 $newdata['height']=round($arr[1]*$ratio);1566 $newdata['typeid']=$typeid;1567 $newdata['premsg']=$premsg;1568 $newdata['src']=$src;1569 echo json_encode($newdata);1570 }1571 public function testsavesub()1572 {1573 $title=$_POST[title];1574 $testdate=$_POST[testdate];1575 $testtime=$_POST[testtime];1576 $subjectid=$_POST[subjectid];1577 $testkindid=$_POST[testkindid];1578 $filesernum=$_POST[filesernum];1579 $userid=$_POST[userid];1580 $testgrade_arr=$_POST[testgrade_arr];1581 $testchapter_arr=$_POST[testchapter_arr];1582 $testkeynote_arr=$_POST[testkeynote_arr];1583 $testlevel=$_POST[testlevel];1584 $myclassobject_arr=$_POST[myclassobject_arr];1585 $groupobject_arr=$_POST[groupobject_arr];1586 $other_note=$_POST[other_note];1587 $testnote=$_POST[testnote];1588 $questionsum=$_POST[questionsum];1589 $score_kind=$_POST[score_kind];1590 $model_paper_msg_data=M('paper_msg_data');1591 //插入试卷信息1592 $model_test_send_class=M('test_send_class');1593 //插入发布班级1594 $model_test_public_data=M('test_public_data');1595 //插入试卷排版信息1596 $paper_msg_arr['kind']=$testkindid;1597 $paper_msg_arr['publish_time']=$testdate;1598 $paper_msg_arr['testtime']=$testtime;1599 $paper_msg_arr['paper_name']=$title;1600 $paper_msg_arr['keynote_id']=$testkeynote_arr;1601 $paper_msg_arr['statusmsg']=2;1602 $paper_msg_arr['creat_time']=date('y-m-d h:i:s',time());1603 $paper_msg_arr['filesernum']=$filesernum;1604 $paper_msg_arr['userid']=$userid;1605 $paper_msg_arr['operatorid']=$userid;1606 $paper_msg_arr['nolevel']=3;1607 $paper_msg_arr['no1']='';1608 $paper_msg_arr['no2']='';1609 $paper_msg_arr['no3']='t12';1610 $paper_msg_arr['no4']='t14';1611 $paper_msg_arr['no5']='t16';1612 $paper_msg_arr['submittime']=date('y-m-d h:i:s',time());1613 $paper_msg_arr['subjectid']=$subjectid;1614 $paper_msg_arr['gradeid']=$testgrade_arr;1615// $paper_msg_arr['settime']='';1616 $paper_msg_arr['chapterid']=$testchapter_arr;1617 $paper_msg_arr['shareornot']=1;1618 $paper_msg_arr['editornot']=0;1619 $paper_msg_arr['othernote']=$other_note;1620 $paper_msg_arr['testnote']=$testnote;1621 $paper_msg_arr['questionsum']=$questionsum;1622 $paper_msg_arr['score_kind']=$score_kind;1623 $testid=$model_paper_msg_data->add($paper_msg_arr);1624 $test_send_class_arr['testid']=$testid;1625 $test_send_class_arr['classid_arr']=$myclassobject_arr;1626 $test_send_class_arr['groupid_arr']=$groupobject_arr;1627 $test_send_class_arr['kind']=1;1628 echo $model_test_send_class->add($test_send_class_arr);1629 }1630 public function questionsavesub()1631 {1632 $testdetailmsg=$_POST[testdetailmsg];1633 //$testdetailmsg="0,1,0,0,0,0,0,t0,test,0,title,一、选择题,123,left,none,1,,20,1,0#1443,2,0,0,0,0,0,t-a,test,0,titleanswer,1.10',123,left,block,1,,20,1,10#1444,3,0,0,0,0,0,t-a,test,0,titleanswer,2.10',123,left,block,1,,20,1,10#1657,4,0,0,0,0,1536988710414,t1,test,0,title,3. 10×2=20',123,left,block,1,,20,1,20#1657,5,0,0,0,0,1536988710414,a,test,0,answer,(1),123,left,block,1,,20,1,10#1657,6,0,0,0,0,1536988710414,a,test,0,answer,(2),123,left,block,1,,20,1,10#0,7,0,0,0,0,0,t0,test,0,title,二、填空题,123,left,none,1,,21,1,0#1576,8,1590,1591,1592,1593,0,t-a,test,4,titleanswer,1.5',123,left,block,1,,21,1,5#1577,9,1591,0,0,0,0,t-a,test,1,titleanswer,2.5',123,left,block,1,,21,1,5#1626,10,0,0,0,0,1536988333236,t1,test,0,title,3. 5×3=15',123,left,block,1,,21,1,15#1626,11,0,0,0,0,1536988333236,a,test,0,answer,(1),123,left,block,1,,21,1,5#1626,12,0,0,0,0,1536988333236,a,test,0,answer,(2),123,left,block,1,,21,1,5#1626,13,0,0,0,0,1536988333236,a,test,0,answer,(3),123,left,block,1,,21,1,5";1634 $testarr=explode('#',$testdetailmsg);1635 $length=sizeof($testarr);1636 $model=M('test_public_data');1637 for($i=0;$i<$length;$i++)1638 {1639 $questionarr=explode(',',$testarr[$i]);1640 $thislength=sizeof($questionarr);1641 $newdata['srcid']=$questionarr[0];1642 $newdata['in_ser']=$questionarr[1];1643 $newdata['pic1']=$questionarr[2];1644 $newdata['pic2']=$questionarr[3];1645 $newdata['pic3']=$questionarr[4];1646 $newdata['pic4']=$questionarr[5];1647 $newdata['tsernum']=$questionarr[6];1648 $newdata['ctbname']=$questionarr[7];1649 $newdata['kind']=$questionarr[8];1650 $newdata['picsum']=$questionarr[9];1651 $newdata['inputname']=$questionarr[10];1652 $newdata['inputval']=$questionarr[11];1653 $newdata['filesernum']=$questionarr[12];1654 $newdata['align']=$questionarr[13];1655 $newdata['imgdisplay']=$questionarr[14];1656 $newdata['pagenum']=$questionarr[15];1657 $newdata['typeid']=$questionarr[17];1658 $newdata['questionnum']=$questionarr[18];1659 $newdata['questionscore']=$questionarr[19];1660 $model->add($newdata);1661 }1662 echo 1;1663 }1664 public function buildlist02(){1665 $userid=$_GET['userid'];1666 $this->assign('userid',$userid);1667 $this->display();1668 }1669 public function phptestlist()1670 {1671 $userid=$_POST['userid'];1672 $nowpage=$_POST['nowpage'];1673 $pagelength=$_POST['pagelength'];1674 $beginnum=($nowpage-1)*$pagelength+1;1675 $beginpagenum=$beginnum-1;1676 $model=M('paper_msg_data');1677 $count=$model->where('userid='.$userid)->count();1678 $data = $model->where('userid='.$userid)->limit($beginpagenum.','.$pagelength)->select();1679 for($i=0;$i<sizeof($data);$i++)1680 {1681 $data[$i]['num']=$beginnum;1682 $beginnum=$beginnum+1;1683 }1684 $data['length']=sizeof($data);1685 $data['pagelength']=$pagelength;1686 $data['count']=$count;1687 $data['pagenum']=ceil($count/$pagelength);1688 echo json_encode($data);1689 }1690 public function pretestpdf01()1691 {1692 $filesernum=$_GET['filesernum'];1693 $paper_name=$_GET['paper_name'];1694 $testnote=$_GET['testnote'];1695 $operkind=$_GET['operkind'];1696 $testid=$_GET['testid'];1697 $kind=$_GET['kind'];1698// echo $filesernum.'#'.$paper_name.'#'.$testnote.'#'.$operkind.'#'.$testid;1699//1700//1701// return;1702//1703// $filesernum='a1001201885224431';1704// $paper_name='图形的相似';1705// $testnote='';1706// $operkind='I';1707// $testid=149;1708// $kind=1;1709 if($kind==1)1710 {1711 $score_kind=1;1712 }1713 else1714 {1715 $model_test=M('paper_msg_data');1716 $data=$model_test->where('id='.$testid)->find();1717 $score_kind=$data['score_kind'];1718 }1719 // echo $kind.','.$score_kind.','.$operkind.','.$filesernum.','.$paper_name.','.$testnote;1720 testpdf($kind,$score_kind,$operkind,$filesernum,$paper_name,$testnote);1721 //print_r($data);1722 }1723 public function preanswerpdf01(){1724 $filesernum=$_GET['filesernum'];1725 $paper_name=$_GET['paper_name'];1726 $testnote=$_GET['testnote'];1727 $operkind=$_GET['operkind'];1728 $testid=$_GET['testid'];1729 preanswerpdf01($paper_name,$filesernum,$operkind);1730 }1731}...

Full Screen

Full Screen

TypeUtilitiesTest.php

Source:TypeUtilitiesTest.php Github

copy

Full Screen

...79 */80 public function testTypeCheckedObjectInvalidArgument() {81 TypeUtilities::buildTypeCheckedObject(42, '[test]');82 }83 public function testClassNameString() {84 $className = '\\Sitegear\\Util\\TestClass';85 $this->assertEquals($className, TypeUtilities::getClassName($className));86 }87 /**88 * @expectedException \DomainException89 */90 public function testClassNameStringClassNotExist() {91 TypeUtilities::getClassName('\\Sitegear\\Foo\\Bar'); // Does not exist92 }93 public function testClassNameReflectionClass() {94 $refClass = new \ReflectionClass('\\Sitegear\\Util\\TestClass');95 $this->assertEquals('Sitegear\\Util\\TestClass', TypeUtilities::getClassName($refClass));96 }97 public function testClassNameObject() {98 $object = new TestClass();99 $this->assertEquals('Sitegear\\Util\\TestClass', TypeUtilities::getClassName($object));100 }101 /**102 * @expectedException \InvalidArgumentException103 */104 public function testClassNameInvalidArgument() {105 TypeUtilities::getClassName(42);106 }107 public function testParametersArray() {108 $params = TypeUtilities::getParameters(array( new TestClass(), 'testMethod' ));109 $this->assertEquals(3, sizeof($params));110 $this->assertFalse($params[0]->isOptional());111 $this->assertEquals('x', $params[1]->getDefaultValue());112 $this->assertNull($params[2]->getDefaultValue());113 }114 public function testParametersCallableObject() {115 $params = TypeUtilities::getParameters(new TestCallable());116 $this->assertEquals(3, sizeof($params));117 $this->assertFalse($params[0]->isOptional());118 $this->assertEquals('x', $params[1]->getDefaultValue());...

Full Screen

Full Screen

TestSimpleListClassFinder.php

Source:TestSimpleListClassFinder.php Github

copy

Full Screen

1<?php2namespace Shoplic\Axis3\Tests\Starters\ClassFinders;3use Shoplic\Axis3\Starters\ClassFinders\SimpleListClassFinder;4use WP_UnitTestCase;5class TestSimpleListClassFinder extends WP_UnitTestCase6{7 private $finder;8 public function testFindAddClasses()9 {10 $finder = new SimpleListClassFinder();11 // 셋업 #1: 2개의 클래스를 삽입.12 $finder->addClasses(13 'default',14 [15 '\\My\\TestClass\\TestClassOne',16 '\\My\\TestClass\\TestClassTwo',17 ]18 );19 $foundClass = [];20 $finder->find($foundClass);21 // 검증 #1: 삽입된 2개의 클래스를 확인.22 $this->assertArrayHasKey('default', $foundClass);23 $this->assertIsArray($foundClass['default']);24 $this->assertEquals(2, sizeof($foundClass['default']));25 // 네임스페이스 가장 앞의 백슬래시는 제거되어야 한다.26 $this->assertEquals('My\\TestClass\\TestClassOne', $foundClass['default'][0]);27 $this->assertEquals('My\\TestClass\\TestClassTwo', $foundClass['default'][1]);28 // 셋업 #2: 2개의 클래스를 추가로 삽입.29 $finder->addClasses(30 'default',31 [32 'My\\TestClass\\TestClassThree',33 'My\\TestClass\\TestClassFour',34 ]35 );36 $foundClass = [];37 $finder->find($foundClass);38 // 검증 #2: 추가된 2개의 클래스를 합쳐 도합 4개의 클래스가 찾아져야 한다.39 $this->assertArrayHasKey('default', $foundClass);40 $this->assertIsArray($foundClass['default']);41 $this->assertEquals(4, sizeof($foundClass['default']));42 $this->assertEquals('My\\TestClass\\TestClassThree', $foundClass['default'][2]);43 $this->assertEquals('My\\TestClass\\TestClassFour', $foundClass['default'][3]);44 // 셋업 #3: $foundClass 에 이미 값이 있다.45 $foundClass = [46 'default' => [47 'My\\TestClass\TestClassAlpha',48 'My\\TestClass\TestClassBravo',49 ]50 ];51 $finder->find($foundClass);52 // 검증 #3: $foundClass 에 이미 들어간 값을 보존하면서 새 값을 추가해야 한다.53 // 그러므로 도합 6개의 클래스가 찾아져야 한다.54 $this->assertArrayHasKey('default', $foundClass);55 $this->assertIsArray($foundClass['default']);56 $this->assertEquals(6, sizeof($foundClass['default']));57 $this->assertEquals('My\\TestClass\\TestClassAlpha', $foundClass['default'][0]);58 $this->assertEquals('My\\TestClass\\TestClassBravo', $foundClass['default'][1]);59 $this->assertEquals('My\\TestClass\\TestClassOne', $foundClass['default'][2]);60 $this->assertEquals('My\\TestClass\\TestClassTwo', $foundClass['default'][3]);61 $this->assertEquals('My\\TestClass\\TestClassThree', $foundClass['default'][4]);62 $this->assertEquals('My\\TestClass\\TestClassFour', $foundClass['default'][5]);63 }64}...

Full Screen

Full Screen

testClass

Using AI Code Generation

copy

Full Screen

1require_once('sizeOf.php');2$sizeOf = new sizeOf();3echo $sizeOf->testClass();4{5 function testClass()6 {7 return "This is test class";8 }9}10You can also use the require_once() function with the include() function. The syntax of the include() function is given below:11include('filename.php');12The syntax of the require_once() function is given below:13require_once('filename.php');14The include() function is used to include a file

Full Screen

Full Screen

testClass

Using AI Code Generation

copy

Full Screen

1require_once('sizeOf.php');2$testClass = new sizeOf();3$testClass->testClass();4{5 public function testClass()6 {7 $array = array('a' => 'apple', 'b' => 'banana', 'c' => 'cranberry');8 echo sizeof($array);9 }10}11Related Posts: PHP | sizeof() Function12PHP | array_unique() Function13PHP | array_values() Function14PHP | array_keys() Function15PHP | array_search() Function16PHP | array_pop() Function17PHP | array_push() Function18PHP | array_shift() Function19PHP | array_unshift() Function20PHP | array_slice() Function21PHP | array_splice() Function22PHP | array_sum() Function23PHP | array_walk() Function24PHP | array_walk_recursive() Function25PHP | array_fill() Function26PHP | array_fill_keys() Function27PHP | array_flip() Function28PHP | array_intersect() Function29PHP | array_intersect_key() Function30PHP | array_intersect_ukey() Function31PHP | array_intersect_assoc() Function32PHP | array_intersect_uassoc() Function33PHP | array_intersect() Function34PHP | array_key_exists() Function35PHP | array_key_first() Function36PHP | array_key_last() Function37PHP | array_keys() Function38PHP | array_map() Function39PHP | array_merge() Function40PHP | array_merge_recursive() Function41PHP | array_multisort() Function42PHP | array_pad() Function43PHP | array_pop() Function44PHP | array_product() Function45PHP | array_push() Function46PHP | array_rand() Function47PHP | array_reduce() Function48PHP | array_replace() Function49PHP | array_replace_recursive() Function50PHP | array_reverse() Function51PHP | array_search() Function52PHP | array_shift() Function53PHP | array_slice() Function54PHP | array_splice() Function55PHP | array_sum() Function56PHP | array_udiff() Function57PHP | array_udiff_assoc() Function58PHP | array_udiff_uassoc() Function59PHP | array_uintersect() Function60PHP | array_uintersect_assoc() Function61PHP | array_uintersect_uassoc() Function62PHP | array_unique() Function63PHP | array_values() Function

Full Screen

Full Screen

testClass

Using AI Code Generation

copy

Full Screen

1require_once('sizeOf.php');2$testClass = new sizeOf();3$testClass->testClass();4{5 public function testClass()6 {7 $arr = array(1, 2, 3, 4, 5);8 echo 'The size of the array is: ' . sizeof($arr);9 }10}11Related Posts: PHP | count() Function12PHP | array() Function13PHP | array_push() Function14PHP | array_pop() Function15PHP | array_shift() Function16PHP | array_unshift() Function17PHP | array_splice() Function18PHP | array_chunk() Function19PHP | array_slice() Function20PHP | array_key_exists() Function21PHP | array_keys() Function22PHP | array_values() Function23PHP | array_merge() Function24PHP | array_combine() Function25PHP | array_flip() Function26PHP | array_unique() Function27PHP | array_search() Function28PHP | array_fill() Function29PHP | array_fill_keys() Function30PHP | array_map() Function31PHP | array_filter() Function32PHP | array_reduce() Function33PHP | array_sum() Function34PHP | array_product() Function35PHP | array_rand() Function36PHP | array_reverse() Function37PHP | array_pad() Function38PHP | array_diff() Function39PHP | array_intersect() Function40PHP | array_key_first() Function41PHP | array_key_last() Function42PHP | array_replace() Function43PHP | array_replace_recursive() Function44PHP | array_column() Function45PHP | array_multisort() Function46PHP | array_diff_assoc() Function47PHP | array_diff_key() Function48PHP | array_diff_uassoc() Function49PHP | array_diff_ukey() Function50PHP | array_intersect_assoc() Function51PHP | array_intersect_key() Function52PHP | array_intersect_uassoc() Function53PHP | array_intersect_ukey() Function54PHP | array_udiff_assoc() Function55PHP | array_udiff_uassoc() Function56PHP | array_udiff() Function57PHP | array_uintersect_assoc() Function58PHP | array_uintersect_uassoc() Function59PHP | array_uintersect() Function60PHP | array_walk_recursive() Function

Full Screen

Full Screen

testClass

Using AI Code Generation

copy

Full Screen

1require_once('sizeOf.php');2$size = new sizeOf();3$size->testClass();4Fatal error: Call to undefined method sizeOf::testClass() in /home/username/public_html/1.php on line 75require_once('sizeOf.php');6$size = new sizeOf();7$size->testClass();8require_once('sizeOf.php');9$size = new sizeOf();10$size->testClass();11require_once('sizeOf.php');12$size = new sizeOf();13$size->testClass();14require_once('sizeOf.php');15$size = new sizeOf();16$size->testClass();17require_once('sizeOf.php');18$size = new sizeOf();19$size->testClass();20require_once('sizeOf.php');21$size = new sizeOf();22$size->testClass();23require_once('sizeOf.php');24$size = new sizeOf();25$size->testClass();26require_once('sizeOf.php');27$size = new sizeOf();

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Atoum automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in sizeOf

Trigger testClass code on LambdaTest Cloud Grid

Execute automation tests with testClass on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful