-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathview.php
130 lines (107 loc) · 4.93 KB
/
view.php
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Main page where the questions are added and file is generated
* @package tool_aikengen
* @copyright 2016 Jamal Aruna <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../../../config.php');
require_once($CFG->dirroot.'/user/profile/lib.php');
require_once($CFG->dirroot.'/tag/lib.php');
require_once($CFG->dirroot .'/course/lib.php');
require_once($CFG->dirroot .'/lib/blocklib.php');
require_once($CFG->dirroot .'/lib/moodlelib.php');
require_once($CFG->libdir .'/pagelib.php');
require_once('lib.php');
require_once('locallib.php');
require_login();
require_capability('tool/aikengen:view', context_system::instance());
$PAGE->set_context(context_system::instance());
$PAGE->set_pagelayout('base');
$PAGE->set_title($SITE->fullname.': Aiken generator ' );
$PAGE->navbar->add('Aiken generator');
$PAGE->set_heading($SITE->fullname);
$PAGE->set_url($CFG->wwwroot.'/admin/tool/aikengen/index.php');
// Custom stylesheet.
$PAGE->requires->css(new moodle_url('styles.css'));
// Custom js files.
$PAGE->requires->js(new moodle_url('js/angular.min.js'), true); // True includes at header,its removal makes it load at the footer.
$PAGE->requires->js(new moodle_url('js/jquery-3.0.0.min.js'), true);
if (!tool_aikengen_user_has_aiken_file_name($USER->id)) {
$message = "You do not have an existing filename.Please create one first before you can add questions";
$returnurl = new moodle_url('index.php');
redirect($returnurl, $message, 5);
}
echo $OUTPUT->header();
?>
<div class="container">
<div class="row">
<div ng-app="myApp" ng-controller="aikenctrl" class="col-md-12">
<div class="col-md-6">
<?php
$qform = new tool_aikengen_entry_form(null, null, null, null, 'ng-submit = "insertdata()", name = "entryForm"');
$toform = '';
$qform->set_data($toform);
$qform->display();
?>
{{successMessage}}
</div>
<div class="col-md-6" id="updated" >
<h3> <?php echo get_string('liveupdates', TOOL_AIKENGEN_LANG); ?> </h3>
<div class="col-md-12">
<?php
$fileview = new tool_aikengen_viewfile_drop_menu_form();
$toform = '';
$fileview->set_data($toform);
$fileview->display();
?>
</div>
<div class="live-update">
<table class="generaltable">
<tbody>
<tr ng-repeat = "item in data">
<td class="cell c{{$index}}" style="">{{$index+1}} - {{item.question}} <br>
A: {{item.option_a}}<br>
B: {{item.option_b}}<br>
C: {{item.option_c}}<br>
D: {{item.option_d}}<br>
E: {{item.option_e}}<br>
Answer: {{item.answer}}<br><br>
<button ng-click="deleteQuestion(item.id,item.fileid)">Delete</button>
<button ng-click="editQuestion(item.id, item.question, item.option_a,
item.option_b,item.option_c,item.option_d,item.option_e,item.answer,
item.fileid)">Edit</button>
</td>
</tr>
</tbody>
</table>
</div>
<hr />
<div class="col-md-12">
<a href="download_question.php?fileid={{viewfileid}}">
<button><?php echo get_string('downloadfile', TOOL_AIKENGEN_LANG); ?></button>
</a>
</div>
</div>
<!-- app js -->
<script src="js/jquey-app.js"></script>
<script src="js/app.js"></script>
</div>
</div>
</div>
<?php
echo $OUTPUT->footer();