]>
Softwares of Agnibho - mcquick.git/blob - mcquick/paper.php
2 /**********************************************************************
4 * Description: Application for creating and solving MCQ papers
5 * Author: Agnibho Mondal
6 * Website: http://code.agnibho.com
7 **********************************************************************
8 Copyright (c) 2014-2015 Agnibho Mondal
10 **********************************************************************
11 This file is part of MCQuick.
13 MCQuick is free software: you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
18 MCQuick is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with MCQuick. If not, see <http://www.gnu.org/licenses/>.
25 **********************************************************************/
29 require_once "lib/php/DB.php";
34 <title
>Papers | MCQuick
</title
>
35 <?php
include("template/head.php"); ?
>
38 <?php
include("template/heading.php"); ?
>
39 <div
class="container">
40 <div
class="text-primary">
41 <div
class="jumbotron">
42 <h2
>MCQuick Question Papers
</h2
>
45 <form
class="form-inline col-sm-offset-4" role
="search">
46 <input type
="text" class="form-control" placeholder
="Search papers" id
="text"/>
47 <select
class="form-control" id
="by">
48 <option value
="title">Paper Title
</option
>
49 <option value
="name">Compiled by
</option
>
50 <option value
="subject">Subject
</option
>
52 <button type
="button" class="btn btn-success" id
="search">Search
</button
>
55 <table
class="table table-hover" id
="paper_list">
56 <tr
><th
>Title
</th
><th
>Compiled by
</th
><th
>Subject
</th
><th
>Date
</th
></tr
>
58 <div
class="text-center">
59 <ul
class="pagination" id
="page">
68 $
(document
).ready(function(){
70 $
("#search").click(function(){
71 search
=$
("#by").val();
72 term
=$
("#text").val().trim();
75 $
("#paper_list").on("click", "tr.linked", function(){
76 document
.location
="index.php?paper="+$
(this
).data("id");
78 $
("#page").on("click", ".nav-page", function(){
79 page
=$
(this
).data("page");
88 query
="search=title&term="+term+
"&list="+page
;
91 query
="search=name&term="+term+
"&list="+page
;
94 query
="search=subject&term="+term+
"&list="+page
;
98 $
("#block-wait").modal("show");
99 $
.get("ajax.php?"+query
, function(data
, status
){
100 $
("#block-wait").modal("hide");
101 if(status
=="success"){
102 obj
=JSON
.parse(data
);
105 $
("#paper_list").html('<tr><th>Paper Title</th><th>Compiled by</th><th>Subject</th><th>Date</th></tr>');
106 for(i
=0; i
<papers
.length
; i++
){
108 date
.setSeconds(papers
[i
]['time']);
109 $
("#paper_list").append("<tr class='linked' data-id='"+papers
[i
]['id']+
"' style='cursor:pointer'><td>"+
esc(papers
[i
]['title'])+
"</th><td>"+papers
[i
]['user']+
"</td><td>"+
esc(papers
[i
]['subject'])+
"</td><td>"+date
.toLocaleDateString()+
"</td></a></tr>");
112 for(i
=1; i
<=num
/10+
1; i++
){
114 $
("#page").append('<li class="active"><a href="#" class="nav-page" data-page="'+i+
'">'+i+
'</a></li>');
117 $
("#page").append('<li><a href="#" class="nav-page" data-page="'+i+
'">'+i+
'</a></li>');
122 $
("#connect-fail").modal("show");
128 return $
("<div/>").text(input
).html();
133 include("template/modals.php");
134 include("template/footer.php");