-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprintQuestionPaper.php
More file actions
106 lines (99 loc) · 3.91 KB
/
printQuestionPaper.php
File metadata and controls
106 lines (99 loc) · 3.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
$noHtml = "1";
include_once 'Header.php';
$questionPaperId = $_REQUEST['questionPaperId'];
$sql = "SELECT cqp. * , ccm.name AS category_name, cq.id AS question_id, cq.questiontext, cqtm.id AS question_type_id, cq.category, cqtm.name AS question_type, cqpr.id AS rule_id
FROM mdl_qpg_question_paper cqp
LEFT JOIN mdl_qpg_question_paper_rules cqpr ON cqpr.question_paper_id = cqp.id
LEFT JOIN mdl_qpg_question_paper_questions cqpq ON cqpq.question_paper_rules_id = cqpr.id
LEFT JOIN mdl_question cq ON cq.id = cqpq.question_id
LEFT JOIN mdl_qpg_question_type_master cqtm ON cqtm.id = cqpr.question_type_id
LEFT JOIN mdl_question_categories ccm ON ccm.id = cqp.category_id
WHERE cqp.id = '$questionPaperId'
ORDER BY cqpr.question_type_id ASC";
$questionRules = GetAll($sql);
$sql = "SELECT SUM(total_marks) total FROM cbsx_question_paper_rules WHERE question_paper_id = $questionPaperId";
$totalMarks = GetOne($sql);
?>
<div style='text-align: center;'><br>
Sample Question Paper<br>
Science<br>
<?php echo $questionRules[0]['category_name']; ?><br>
<?php echo $questionRules[0]['term']; ?> (<?php echo $questionRules[0]['year']; ?> - <?php echo ($questionRules[0]['year']+1); ?>)<br>
<table align='center'>
<tr>
<td align='left'>
TIME: <?php echo $questionRules[0]['total_time']; ?> hrs
</td>
<td align='right'>
MM: <?php echo $totalMarks; ?>
</td>
</tr>
<tr>
<td colspan="2" align='left'>General Instructions</td>
</tr>
<tr>
<td colspan="2">
<table>
<tr>
<td>i) </td>
<td>
The question paper consists of two sections, A and B, You are to attend both the sections.
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<?php
foreach($questionRules as $questionItem)
{
if($questionItem['question_type'] != "")
{
$questions[] = array('question' => $questionItem['questiontext'],
'type' => $questionItem['question_type'],
'question_id' => $questionItem['question_id'],
'question_paper_rules_id' => $questionItem['rule_id'],
'chapter_id' => $questionItem['category'],
'question_type_id' => $questionItem['question_type_id']);
}
}
$section = array("1" => "UnKnown","VSA" => "Section - A", "SA-1" => "Section - B", "SA-2" => "Section - C", "LA" => "Section - D", "MCQ" => "Section - E");
$temp = "";
foreach($questions as $key => $question)
{
if($temp != $question['type'])
{
$temp = $question['type'];
echo "<br><div style='text-align:center;font-weight:bold;font-size:20px;text-decoration:underline;'>". $section[$question['type']] ."</div>";
}
if(substr($question['question'],0,3) == '<p>')
{
$paraStart = '<p>';
$paraEnd = '</p>';
}
else
{
$paraStart = '';
$paraEnd = '';
}
?>
<div style="border-top: 0px solid #ccc;">
<table border="0">
<tr>
<td style="padding:0px 20px 0 20px;vertical-align: top;">
<?php echo $paraStart; ?><?php echo "" . ($key+1) . "."; ?><?php echo $paraEnd; ?>
</td>
<td style="vertical-align: top;" question_id="<?php echo $question['question_id']; ?>" question_paper_rules_id="<?php echo $question['question_paper_rules_id']; ?>" class="questions" id="questionid_<?php echo $key; ?>">
<?php echo $paraStart; ?><?php echo $question['question']; ?><?php echo $paraEnd; ?>
</td>
</tr>
</table>
</div>
<?php
}
?>
<script type="text/javascript">
print();
</script>