<?php
class app
{
public $G;
public $data = array();
public $sessionvars;
public function __construct(&$G)
{
$this->G = $G;
$this->ev = $this->G->make('ev');
$this->tpl = $this->G->make('tpl');
$this->sql = $this->G->make('sql');
$this->db = $this->G->make('db');
$this->pg = $this->G->make('pg');
$this->html = $this->G->make('html');
$this->session = $this->G->make('session');
$this->_user = $this->session->getSessionUser();
if(!$this->_user['sessionuserid'])
{
if($this->ev->get('userhash'))
exit(json_encode(array(
'statusCode' => 300,
"message" => "请您重新登录",
"callbackType" => 'forward',
"forwardUrl" => "index.php?user-app-login"
)));
else
{
header("location:index.php?user-app-login");
exit;
}
}
$this->user = $this->G->make('user','user');
$this->exam = $this->G->make('exam','exam');
$this->basic = $this->G->make('basic','exam');
$this->section = $this->G->make('section','exam');
$this->question = $this->G->make('question','exam');
$this->info = $this->G->make('info','exam');
$this->favor = $this->G->make('favor','exam');
$this->answer = $this->G->make('answer','exam');
$this->sessionvars = $this->exam->getExamSessionBySessionid();
$this->questypes = $this->basic->getQuestypeList();
$this->subjects = $this->basic->getSubjectList();
$openbasics = trim($this->sessionvars['examsessionopenbasics']," ,");
$this->data['openbasics'] = $this->basic->getBasicsByApi($openbasics);
if(!$this->data['openbasics'])$this->data['openbasics'] = $this->basic->getOpenBasicsByUserid($this->_user['sessionuserid']);
//if(!$this->data['openbasics'])$this->data['openbasics'] = $this->basic->getBasicsByArgs("basicdemo = '1'");
if(!$this->_user['sessioncurrent'] || !$this->data['openbasics'][$this->_user['sessioncurrent']])
{
$this->data['currentbasic'] = current($this->data['openbasics']);
$this->_user['sessioncurrent'] = $this->data['currentbasic']['basicid'];
$this->session->setSessionValue(array('sessioncurrent'=>$this->_user['sessioncurrent']));
}
else
$this->data['currentbasic'] = $this->data['openbasics'][$this->_user['sessioncurrent']];
$this->selectorder = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N');
$this->tpl->assign('ols',array(1=>'一','二','三','四','五','六','七','八','九','十','十一','十二','十三','十四','十五','十六','十七','十八','十九','二十'));
$this->tpl->assign('selectorder',$this->selectorder);
$this->tpl->assign('data',&$this->data);
$this->tpl->assign('questypes',$this->questypes);
$this->tpl->assign('subjects',$this->subjects);
$this->tpl->assign('globalsections',$this->section->getSectionListByArgs("sectionsubjectid = '{$this->data['currentbasic']['basicsubjectid']}'"));
$this->tpl->assign('globalknows',$this->section->getAllKnowsBySubject($this->data['currentbasic']['basicsubjectid']));
$this->tpl->assign('_user',$this->user->getUserById($this->_user['sessionuserid']));
$this->tpl->assign('userhash',$this->ev->get('userhash'));
}
public function basics()
{
$action = $this->ev->url(3);
$page = $this->ev->get('page');
switch($action)
{
case 'openit':
$basicid = $this->ev->get('basicid');
$basic = $this->basic->getBasicById($basicid);
if(!$basic)
{
$message = array(
'statusCode' => 300,
"message" => "操作失败,此考场不存在"
);
exit(json_encode($message));
}
$userid = $this->_user['sessionuserid'];
if($this->basic->getOpenBasicByUseridAndBasicid($userid,$basicid))
{
$message = array(
'statusCode' => 300,
"message" => "您已经开通了本考场"
);
}
if($basic['basicdemo'])
{
$time = 365*24*3600;
}
else
{
$opentype = intval($this->ev->get('opentype'));
$price = 0;
if(trim($basic['basicprice']))
{
$price = array();
$basic['basicprice'] = explode("\n",$basic['basicprice']);
foreach($basic['basicprice'] as $p)
{
if($p)
{
$p = explode(":",$p);
$price[] = array('time'=>intval($p[0]),'price'=>intval($p[1]));
}
}
}
if(!$price[$opentype])$t = $price[0];
else
$t = $price[$opentype];
$time = $t['time']*24*3600;
$score = $t['price'];
$user = $this->user->getUserById($this->_user['sessionuserid']);
if($user['usercoin'] < $score)
{
$message = array(
'statusCode' => 300,
"message" => "操作失败,您的积分不够"
);
exit(json_encode($message));
}
else
{
$args = array("usercoin" => $user['usercoin'] - $score);
$this->user->modifyUserInfo($args,$this->_user['sessionuserid']);
}
}
$args = array('obuserid'=>$userid,'obbasicid'=>$basicid,'obendtime'=>TIME + $time);
$this->basic->openBasic($args);
$message = array(
'statusCode' => 200,
"message" => "操作成功",
"callbackType" => "forward",
"forwardUrl" => "index.php?exam-app"
);
exit(json_encode($message));
break;
case 'coupon':
if($this->ev->get('coupon'))
{
$couponsn = strtoupper($this->ev->get('couponsn'));
$r = $this->G->make('coupon','bank')->useCouponById($couponsn,$this->_user['sessionuserid']);
if(!$r)
$message = array(
'statusCode' => 300,
"message" => "错误的代金券"
);
elseif($r == '301')
$message = array(
'statusCode' => 300,
"message" => "使用过的代金券"
);
elseif($r == '302')
$message = array(
'statusCode' => 300,
"message" => "过期的代金券"
);
else
$message = array(
'statusCode' => 200,
"message" => "充值成功",
"callbackType" => "forward",
"forwardUrl" => "reload"
);
}
else
$message = array(
'statusCode' => 300,
"message" => "操作失败"
);
exit(json_encode($message));
break;
case 'detail':
$this->basic->delOpenPassBasic($this->_user['sessionuserid']);
$this->area = $this->G->make('area','exam');
$basicid = $this->ev->get('basicid');
$basic = $this->basic->getBasicById($basicid);
$areas = $this->area->getAreaList();
$price = 0;
if(trim($basic['basicprice']))
{
$price = array();
$basic['basicprice'] = explode("\n",$basic['basicprice']);
foreach($basic['basicprice'] as $p)
{
if($p)
{
$p = explode(":",$p);
$price[] = array('time'=>$p[0],'price'=>$p[1]);
}
}
$this->tpl->assign('price',$price);
}
$isopen = $this->basic->getOpenBasicByUseridAndBasicid($this->_user['sessionuserid'],$basicid);
$this->tpl->assign('isopen',$isopen);
$this->tpl->assign('areas',$areas);
$this->tpl->assign('basic',$basic);
$this->tpl->display('basics_detail');
break;
case 'open':
$this->area = $this->G->make('area','exam');
$search = $this->ev->get('search');
$page = $page > 1?$page:1;
$subjects = $this->basic->getSubjectList();
if(!$search)
$args = 1;
else
{
$args = array();
if($search['basicdemo'])$args[] = "basicdemo = '{$search['basicdemo']}'";
if($search['keyword'])$args[] = "basic LIKE '%{$search['keyword']}%'";
if($search['basicareaid'])$args[] = "basicareaid = '{$search['basicareaid']}'";
if($search['basicsubjectid'])$args[] = "basicsubjectid = '{$search['basicsubjectid']}'";
if($search['basicapi'])$args[] = "basicapi = '{$search['basicapi']}'";
}
$basics = $this->basic->getBasicList($page,20,$args);
$areas = $this->area->getAreaList();
$this->tpl->assign('search',$search);
$this->tpl->assign('areas',$areas);
$this->tpl->assign('subjects',$subjects);
$this->tpl->assign('basics',$basics);
$this->tpl->display('basics_open');
break;
de
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
PHPEMS线上考试系统 1.2.1源码:基於PHP+Mysql开发,是国内首款支持手动自动一体评分的PHP线上模拟考试系统。本源码原来为会计从业资格证的无纸化考试系统开发,经一年多的修改和完善,已经可以适用於驾照考试模拟丶英语试题模拟丶其他文字类模拟考试系统。
资源推荐
资源详情
资源评论
收起资源包目录
phpems.rar_MySQL考试_PHPEMS_PHP考试系统_考试_英语 (785个子文件)
bootstrap.css 124KB
bootstrap-combined.min.css 123KB
mathquill.css 49KB
core.css 41KB
jquery-ui.css 33KB
editor_ie7.css 33KB
editor_iequirks.css 32KB
editor_ie8.css 32KB
editor_ie.css 31KB
editor_gecko.css 30KB
editor.css 30KB
bootstrap-responsive.css 22KB
dialog_ie7.css 16KB
dialog_ie8.css 16KB
dialog_iequirks.css 16KB
dialog_ie.css 16KB
dialog_opera.css 15KB
exam_paper.css 15KB
dialog.css 15KB
global.css 9KB
green.css 8KB
black.css 8KB
blue.css 8KB
default.css 8KB
style.css 7KB
opera.css 7KB
aero.css 7KB
idialog.css 7KB
chrome.css 6KB
layoutit.css 6KB
twitter.css 6KB
simple.css 6KB
datepicker.css 5KB
login.css 3KB
theme.css 3KB
contents.css 2KB
templates.css 2KB
plugin.css 1KB
toolbar.css 1KB
wsc.css 1KB
theme.css 1KB
uploadify.css 763B
plugin.css 339B
Thumbs.db 144KB
icon.gif 10KB
loader.gif 9KB
fenshu.gif 8KB
function.gif 5KB
bg-menu-tab.gif 3KB
noimage.gif 1KB
lesson_nav_bg.gif 930B
noupload.gif 868B
open_left_btn.gif 549B
cry_smile.gif 468B
angel_smile.gif 465B
confused_smile.gif 464B
sad_smile.gif 460B
wink_smile.gif 458B
whatchutalkingabout_smile.gif 452B
omg_smile.gif 451B
regular_smile.gif 450B
shades_smile.gif 449B
tongue_smile.gif 446B
tounge_smile.gif 446B
angry_smile.gif 443B
embarrassed_smile.gif 442B
teeth_smile.gif 442B
embaressed_smile.gif 442B
devil_smile.gif 436B
envelope.gif 426B
template3.gif 422B
thumbs_down.gif 408B
thumbs_up.gif 396B
loading.gif 381B
template1.gif 375B
lightbulb.gif 368B
template2.gif 333B
none.gif 260B
kiss.gif 241B
broken_heart.gif 192B
heart.gif 183B
ColumnBg.gif 152B
hiddenfield.gif 105B
icon-mark.gif 69B
pagebreak.gif 54B
spacer.gif 43B
index.htm 1B
index.htm 1B
index.htm 1B
index.htm 1B
index.htm 0B
index.htm 0B
tmpFrameset.html 2KB
ciframe.html 1KB
preview.html 159B
h-1.jpg 116KB
h-2.jpg 109KB
tit_bg.jpg 67KB
h-7.jpg 59KB
13777903931683.jpg 52KB
共 785 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
小波思基
- 粉丝: 72
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功