Artificial Intelligence Programming Lab(AIPLab) 討論區

Please login or register.

請輸入帳號, 密碼以及預計登入時間

新聞:

[慶賀]恭喜亞大獲《泰晤士報》亞洲最佳大學排名第83名,國內排名第十名-20170201

作者 主題: exams.php  (閱讀 3105 次)

admin

  • 管理員
  • Hero Member
  • *****
  • 文章: 1897
    • 檢視個人資料
exams.php
« 於: 四月 07, 2016, 08:06:11 am »
程式碼: [Select]
<?php
require_once 'db_functions.php';
session_start(); 
$redir NULL;
if (empty(
$_GET["school"]))
{
  
$redir "error.php";
  
header("Location: $redir");
  exit;
}
$schoolInfo NULL;
$sid strtoupper($_GET["school"]);
if(isset(
$_SESSION['sinfo']))
{
  
$schoolInfo $_SESSION['sinfo'];
}
if (
$schoolInfo == NULL || $schoolInfo['sid']!=$sid)
{
  
$schoolInfo GetSchoolInfo($sid);
  if(
$schoolInfo == NULL)
  {
    
$_SESSION['sid'] = $sid;
    
$redir "error.php";
    
header("Location: $redir");
    exit;
  }
  
$_SESSION['sinfo'] = $schoolInfo;
}
//level, schname, tel, fax, schooladdr, schoolurl
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="zh-TW">
<head>
<meta charset="utf-8">
<title><?php echo $schoolInfo['schname'?>網站</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="keywords" lang="zh-TW" content="國中試題 , 國小試題 , 高雄市教育雲" />
<meta name="title" content="<?php echo $schoolInfo['schname'?>試題網站" />
<meta property="og:locale" content="zh_TW" />
<meta property="og:title" content="<?php echo $schoolInfo['schname'?>試題網站" />
<meta property="og:type" content="website" />
<meta property="og:url" content="http://exam.kh-city.net/<?php echo $sid ?>/exams.php" />
<meta property="og:image" content="http://exam.kh-city.net/images/fb.jpg" />
<meta property="og:image:width" content="265" />
<meta property="og:image:height" content="233" />
<meta property="og:site_name" content="高雄市試題雲" />
<meta property="og:description" content="<?php echo $schoolInfo['schname'?>提供本校及其他學校復習用考古題,本校家長和同學可以查看相同版本的考古題。" />

    <!-- bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
<!-- jQuery  -->

<!-- bootstrap JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->

    <!-- This is the Javascript file of jqGrid -->   
    <script type="text/ecmascript" src="/js/jquery.min.js"></script>
    <script type="text/ecmascript" src="/js/jquery-ui.min.js"></script>
    <script type="text/ecmascript" src="/js/trirand/jquery.jqGrid.min.js"></script>
    <!-- This is the localization file of the grid controlling messages, labels, etc.
    <!-- We support more than 40 localizations -->
    <script type="text/ecmascript" src="/js/trirand/i18n/grid.locale-tw.js"></script>
    <!-- A link to a jQuery UI ThemeRoller theme, more than 22 built-in and many more custom -->
    <link rel="stylesheet" type="text/css" media="screen" href="/css/jquery-ui.css" />
    <!-- The link to the CSS that the grid needs -->
    <link rel="stylesheet" type="text/css" media="screen" href="/css/trirand/ui.jqgrid.css" />
</head>
<body>
<?php
echo '<input type="hidden" id="sid" name="sid" value="'.$sid.'">';
echo 
'<input type="hidden" id="level" name="level" value="'.$schoolInfo['level'].'">';
?>


<!-- Static navbar -->
<!-- Static navbar -->
<nav class="navbar navbar-default navbar-static-top">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="<?php echo $schoolInfo['schoolurl'?>"><?php echo $schoolInfo['schname'?>網站</a>
    </div>
    <div id="navbar" class="navbar-collapse collapse">
      <ul class="nav navbar-nav">
        <li><a  href="http://exam.kh-city.net/">其他學校的試題網站</a></li>
      </ul>
    </div><!--/.nav-collapse -->
  </div>
</nav>
<div class="container">
    <div class="row">
      <div class="col-xs-12 col-md-12">
 <div class="container" id="jbContainer">
    <div class="panel panel-default">
<div class="panel-body">
      <div class="table-responsive">
          <table class="table">
            <tr>
              <td><img src="/images/sylogo.png" class="img-responsive"></td>
              <td><h3 class="text text-primary">  <?php echo $schoolInfo['schname'?>的段考試題 </h3>
              <p class="navbar-text">學校網址:<a href="<?php echo $schoolInfo['schoolurl'?>"><?php echo $schoolInfo['schoolurl'?></a></p>
              <p class="navbar-text">學校地址:<?php echo $schoolInfo['schooladdr'?></p>
              <p class="navbar-text">學校電話:<?php echo $schoolInfo['tel'?></p>
            </tr>
          </table>
        </div>
    </div>
</div>
    <table cellspacing="0" id="toolbar-content" cellpadding="0" border="0" role="row"      style="table-layout: fixed;" class="ui-pg-table">
<tr>
        <td width="120" class="ui-pg-button ui-corner-all">
        <select id='gridSemester' >
          <option value="All" selected="selected">所有學期</option>
          <?php
  
      $schoolSemesters GetSchoolSemesters($sid);
  
       //for ($i = 0; $i < count($schoolYears); $i++) 
  
    foreach ($schoolSemesters as $ss)
  
    echo '<option value="'.$ss[0].'">'.$ss[0].'學期</option>';
  
          /*<option value="1031">1031學期</option>*/
  
    ?>

      </select>
        </td>
        <td width="120" class="ui-pg-button ui-corner-all">
        <select id='gridGrade' >
           <option value="All" selected="selected">所有年級</option>
 <?php
  
if($schoolInfo['level']=='國中')
    print 
'<option value="國一">國一</option>
           <option value="國二">國二</option>
           <option value="國三">國三</option>'
;
  else
    print 
'<option value="小一">小一</option>
           <option value="小二">小二</option>
           <option value="小三">小三</option>
           <option value="小四">小四</option>
           <option value="小五">小五</option>
           <option value="小六">小六</option>'
;       
 
?>
         
           
        </select>
        </td>
        <td width="120" class="ui-pg-button ui-corner-all">
         <select id='gridSubject' >
           <option value="All" selected="selected">所有學科</option>
 <?php
  
if($schoolInfo['level']=='國中')
    print 
'<option value="國文" >國文</option>
           <option value="數學" >數學</option>
           <option value="英語" >英語</option>
           <option value="自然" >自然</option>
           <option value="社會" >社會</option>'
;
  else
    print 
'<option value="國語" >國語</option>
           <option value="數學" >數學</option>
           <option value="英語" >英語</option>
           <option value="生活" >生活</option>
           <option value="自然" >自然</option>
           <option value="社會" >社會</option>'
;       
 
?>

         </select>
        </td>
        <td width="200" class="ui-pg-button ui-corner-all">
         <select id='gridExamType' >
           <option value="All" selected="selected">每次段考</option>
           <option value="第一次段考" >第一次段考(期中考)</option>
           <option value="第二次段考" >第二次段考(期中考)</option>
           <option value="第三次段考" >第三次段考(期末考)</option>
         </select>
        </td>
    </tr>
</table> 
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
       
<script type="text/javascript">

$(function(){
//alert($("#level").val());

InitClientGrid();
$(window).bind('resize', function() {
      jQuery("#jqGrid").setGridWidth($("#jbContainer").width(), true);
  }).trigger('resize');
 
$("#gridSemester" ).change(function() {
  $('#jqGrid').trigger("reloadGrid");
});
 
$("#gridGrade" ).change(function() {
  $('#jqGrid').trigger("reloadGrid");
});
   
$("#gridSubject" ).change(function() {
  $('#jqGrid').trigger("reloadGrid");
});

$("#gridExamType" ).change(function() {
  $('#jqGrid').trigger("reloadGrid");
});

});//jQuery initializations


function InitClientGrid() {
$("#jqGrid").jqGrid({
    url:'/exam_json.php',
  postData: {
    sid: function() { return $("#sid").val();},
    level: function() { return $("#level").val();},
    semester: function() { return $("#gridSemester option:selected").val();},
    grade: function() { return $("#gridGrade option:selected").val();},
    subject: function() { return $("#gridSubject option:selected").val();},
    examtype: function() { return $("#gridExamType option:selected").val();}
   },
    datatype: 'json',
    mtype: 'GET',
  width: $(window).width(),
  height: 465,
  colNames:['學期','年級','科目', '類別', '版本','本校試題', '本校答案', '同版本試題'],
    //colNames:['學年', '學期','年級','版本','科目', '類別', '本校試題', '同版本參考試題'],
  colModel :[
    {name:'semester', index:'semester', width:100, align:'center', sortable:true},
    {name:'grade', index:'grade', width:100, align:'center', sortable:true},
    {name:'subject', index:'subject', width:100, align:'center', sortable:true},
    {name:'examtype',  index:'examtype', width:150, align:'center', sortable:true},
    {name:'publisher', index:'publisher', width:100, align:'center', sortable:false},
    {name:'testfile',  index:'testfile', width:150, align:'center', sortable:false, formatter:formater1},
    {name:'ansfile',  index:'ansfile', width:150, align:'center', sortable:false, formatter:formater2},
    {name:'refpaper',  index:'refpaper', width:150, align:'center', sortable:false, formatter:formater3}
    ],
  sortname: 'semester',
  sortorder: 'desc',
  viewrecords: true,
  rowNum: 20,
  pager: "#jqGridPager"
  });
}


function formater1(cellValue, opts, rowObject)
{
  if (cellValue=="none")
    return "";//return "試卷尚未公開";
  //$id = "檢視通報表";
    //return "<a target='_blank' href='downloadFile.php?id="+ cellValue +"&type=test'>->題目卷下載</a>";
  return "<a class='btn btn-default btn-xs' target='_blank' href='http://exam.naer.edu.tw/otc/testStoreFile/"+ cellValue +"'>題目卷下載</a>";

}
function formater2(cellValue, opts, rowObject)
{
  if (cellValue=="none")
    return "";//return "答案尚未公開";
  //$id = "檢視通報表";
  //return cellValue;
  return "<a class='btn btn-default btn-xs' target='_blank' href='http://exam.naer.edu.tw/otc/testStoreFile/"+ cellValue +"&type=ans'>答案卷下載</a>";
}
function formater3(cellValue, opts, rowObject)
{
  if (cellValue=="none")
  return "";//return "答案尚未公開";
  //return "他校考古題";
    //return "<a target='_blank' href='"+ cellValue +"'>檢視審核</a>";
  //return "<a target='_blank' href='showRefs.php?id="+ cellValue +"'>他校考古題</a>";
  return "<a class='btn btn-default btn-xs' target='_blank' href='showRefs.php?pno="+ cellValue +"'>他校考古題</a>";
}
</script>
</div></div></div>//

    </div>
<div class="panel-footer">
  <div class="text-right">
<span><a target='_blank' href="https://www.facebook.com/smallforce4web">by SFSW中小學網站小型應援團(Small force for school websites)</a></span>
  </div>
</div>
</body>
</html>
已記錄

admin

  • 管理員
  • Hero Member
  • *****
  • 文章: 1897
    • 檢視個人資料
回覆: exams.php
« 回覆文章 #1 於: 四月 07, 2016, 08:07:10 am »
error.php
程式碼: [Select]
<?php
//2016/3/6 當註冊後回到這裡,登入直接填入身份證字號和姓名
session_start();
$sid "";
$msg "很抱歉,網站發生錯誤。";
if(isset(
$_SESSION['sid']))
{
  
$sid $_SESSION['sid'];
  
$msg "很抱歉,".$sid."目前不是有效的學校代號。";
  unset(
$_SESSION["sid"]); 
}

?>

<html lang="zh-Hant-TW">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>高雄市中小學段考試題網站</title>
    <!-- bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
<!-- jQuery  -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!-- bootstrap JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<style type="text/css">
img {
    top: 0; bottom:0; left: 0; right:0;
    margin: auto;
}
.jumbotron .container {
  margin-top: 0px;
  top:0px;
}
.jumbotron p, span {
  font-family: "Helvetica Neue", Helvetica, Arial, "微軟正黑體", "微软雅黑", "メイリオ", "맑은 고딕", sans-serif;
  font-size: 18px;
  color: #6A5ACD;
}
</style>
 
  <body>
  <div class="container">
    <div class="row">
      <div class="col-xs-12 col-md-8 col-md-offset-2 text-center">           
        <div class="text-center"><img src="/images/title.jpg" class="img-responsive" alt="title"></div>
        <div class="alert alert-info" role="alert">
          <h2>高雄市中小學段考試題</h2>
         
        </div>
      </div>
      <div class="col-xs-0 col-md-2"></div>
    </div>
  </div>
  <div class="container">
    <div class="row text-center">
      <div class="col-xs-12 col-md-8 col-md-offset-2 text-center"> 
        <div class="alert alert-danger" role="alert">
          <h3><?php echo $msg ?></h3>
         </div>
        </div>
       </div>
    </div>   

       
   <div class="container">
    <div class="row">
      <div class="col-xs-12 col-md-8 col-md-offset-2 text-center">           
        <div class="alert alert-success">
        </div>
      </div>
    </div>
  </div>   
  </body>
</html>
已記錄
 

SimplePortal Classic 2.0.5