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.1 3.6.2 3.6.3 3.6.4 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.8.0 3.8.1 3.8.2 3.8.3 3.9.0 3.9.1 3.9.10 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9
tutor / templates / single / assignment / content.php
tutor / templates / single / assignment Last commit date
content.php 5 years ago
content.php
312 lines
1 <?php
2
3 /**
4 * @package TutorLMS/Templates
5 * @version 1.4.3
6 */
7
8 if (!defined('ABSPATH'))
9 exit;
10 global $wpdb;
11 $is_submitted = false;
12 $is_submitting = tutor_utils()->is_assignment_submitting(get_the_ID());
13 //get the comment
14 $post_id = get_the_ID();
15 $user_id = get_current_user_id();
16 $assignment_comment = tutor_utils()->get_single_comment_user_post_id($post_id, $user_id);
17
18 if ($assignment_comment != false) {
19 $submitted = $assignment_comment->comment_approved;
20 $submitted == 'submitted' ? $is_submitted = true : '';
21 }
22 ?>
23
24 <?php do_action('tutor_assignment/single/before/content'); ?>
25
26 <div class="tutor-single-page-top-bar">
27 <div class="tutor-topbar-item tutor-hide-sidebar-bar">
28 <a href="javascript:;" class="tutor-lesson-sidebar-hide-bar"><i class="tutor-icon-angle-left"></i> </a>
29 <?php $course_id = get_post_meta(get_the_ID(), '_tutor_course_id_for_assignments', true); ?>
30 <a href="<?php echo get_the_permalink($course_id); ?>" class="tutor-topbar-home-btn">
31 <i class="tutor-icon-home"></i> <?php echo __('Go to Course Home', 'tutor'); ?>
32 </a>
33 </div>
34 <div class="tutor-topbar-item tutor-topbar-content-title-wrap">
35 <?php
36 tutor_utils()->get_lesson_type_icon(get_the_ID(), true, true);
37 the_title(); ?>
38 </div>
39 </div>
40
41 <div class="tutor-lesson-content-area">
42 <div class="tutor-assignment-title">
43 <h2><?php the_title(); ?></h2>
44 </div>
45
46 <div class="tutor-assignment-information">
47 <?php
48 $time_duration = tutor_utils()->get_assignment_option(get_the_ID(), 'time_duration', array('time'=>'', 'value'=>0));
49
50 $total_mark = tutor_utils()->get_assignment_option(get_the_ID(), 'total_mark');
51 $pass_mark = tutor_utils()->get_assignment_option(get_the_ID(), 'pass_mark');
52
53 global $post;
54 $assignment_created_time = strtotime($post->post_date_gmt);
55 $time_duration_in_sec = 0;
56 if (isset($time_duration['value']) and isset($time_duration['time'])) {
57 switch ($time_duration['time']) {
58 case 'hours':
59 $time_duration_in_sec = 3600;
60 break;
61 case 'days':
62 $time_duration_in_sec = 86400;
63 break;
64 case 'weeks':
65 $time_duration_in_sec = 7 * 86400;
66 break;
67 default:
68 $time_duration_in_sec = 0;
69 break;
70 }
71 }
72 $time_duration_in_sec = $time_duration_in_sec * $time_duration['value'];
73 $remaining_time = $assignment_created_time + $time_duration_in_sec;
74 $now = time();
75
76 ?>
77
78 <ul>
79 <li>
80 <?php _e('Time Duration : ', 'tutor') ?>
81 <strong><?php echo $time_duration["value"] ? $time_duration["value"] . ' ' . $time_duration["time"] : __('No limit', 'tutor'); ?></strong>
82 </li>
83 <?php
84 /*
85 *time_duration[value]==0 means no limit
86 *if have unlimited time then no msg should
87 *appear
88 */
89 if ($time_duration['value'] != 0) :
90 if ($now > $remaining_time and $is_submitted == false) : ?>
91 <li>
92 <?php _e('Deadline : ', 'tutor') ?>
93 <strong><?php _e('Expired', 'tutor'); ?></strong>
94 </li>
95 <?php
96 endif;
97 endif;
98 ?>
99 <!--<li>
100 <?php /*_e('Time Remaining : ') */ ?>
101 <strong><?php /*echo "7 Days, 12 Hour"; */ ?></strong>
102 </li>-->
103
104 <li>
105 <?php _e('Total Points : ', 'tutor') ?>
106 <strong><?php echo $total_mark; ?></strong>
107 </li>
108 <li>
109 <?php _e('Minimum Pass Points : ', 'tutor') ?>
110 <strong><?php echo $pass_mark; ?></strong>
111 </li>
112 </ul>
113 </div>
114
115 <hr />
116 <?php
117 /*
118 *time_duration[value]==0 means no limit
119 *if have unlimited time then no msg should
120 *appear
121 */
122 if ($time_duration['value'] != 0) :
123 if ($now > $remaining_time and $is_submitted == false) : ?>
124 <div class="tutor-asignment-expire tutor-alert-danger tutor-alert" style="margin:36px 0 46px">
125
126 <?php _e('You have missed the submission deadline. Please contact the instructor for more information.', 'tutor'); ?>
127
128 </div>
129 <?php
130 endif;
131 endif;
132 ?>
133 <div class="tutor-assignment-content">
134 <h2><?php _e('Description', 'tutor'); ?></h2>
135
136 <?php the_content(); ?>
137 </div>
138
139 <?php
140 $assignment_attachments = maybe_unserialize(get_post_meta(get_the_ID(), '_tutor_assignment_attachments', true));
141 if (tutor_utils()->count($assignment_attachments)) {
142 ?>
143 <div class="tutor-assignment-attachments">
144 <h2><?php _e('Attachments', 'tutor'); ?></h2>
145 <?php
146 foreach ($assignment_attachments as $attachment_id) {
147 if ($attachment_id) {
148
149 $attachment_name = get_post_meta($attachment_id, '_wp_attached_file', true);
150 $attachment_name = substr($attachment_name, strrpos($attachment_name, '/') + 1);
151 ?>
152 <p class="attachment-file-name">
153 <a href="<?php echo wp_get_attachment_url($attachment_id); ?>" target="_blank">
154 <i class="tutor-icon-attach"></i> <?php echo $attachment_name; ?>
155 </a>
156 </p>
157 <?php
158 }
159 }
160 ?>
161 </div>
162 <?php
163 }
164
165 if ($is_submitting and ($remaining_time > $now or $time_duration['value'] == 0)) { ?>
166 <div class="tutor-assignment-submit-form-wrap">
167 <h2><?php _e('Assignment answer form', 'tutor'); ?></h2>
168
169 <form action="" method="post" id="tutor_assignment_submit_form" enctype="multipart/form-data">
170 <?php wp_nonce_field(tutor()->nonce_action, tutor()->nonce); ?>
171 <input type="hidden" value="tutor_assignment_submit" name="tutor_action" />
172 <input type="hidden" name="assignment_id" value="<?php echo get_the_ID(); ?>">
173
174 <?php $allowd_upload_files = (int) tutor_utils()->get_assignment_option(get_the_ID(), 'upload_files_limit'); ?>
175
176 <div class="tutor-form-group">
177 <p><?php _e('Write your answer briefly', 'tutor'); ?></p>
178 <textarea name="assignment_answer"></textarea>
179 </div>
180
181 <div id="form_validation_response"></div>
182
183 <?php if ($allowd_upload_files) { ?>
184 <p><?php _e('Attach assignment files', 'tutor'); ?></p>
185 <div class="tutor-assignment-attachment-upload-wrap">
186 <?php
187 for ($item = 1; $item <= $allowd_upload_files; $item++) {
188 ?>
189 <div class="tutor-form-group">
190 <label for="tutor-assignment-input-<?php echo $item; ?>"><i class="tutor-icon-upload-file"></i><span><?php _e('Upload file', 'tutor'); ?></span></label>
191 <input class="tutor-assignment-file-upload" id="tutor-assignment-input-<?php echo $item; ?>" type="file" name="attached_assignment_files[]">
192 </div>
193 <?php
194 }
195 ?>
196 </div>
197 <?php
198 }
199 ?>
200 <div class="tutor-assignment-submit-btn-wrap">
201 <button type="submit" class="tutor-button tutor-success" id="tutor_assignment_submit_btn"> <?php _e('Submit Assignment', 'tutor');
202 ?> </button>
203 </div>
204 </form>
205
206 </div>
207
208 <?php
209 } else {
210
211 $submitted_assignment = tutor_utils()->is_assignment_submitted(get_the_ID());
212 if ($submitted_assignment) {
213 $is_reviewed_by_instructor = get_comment_meta($submitted_assignment->comment_ID, 'evaluate_time', true);
214
215 if ($is_reviewed_by_instructor) {
216 $assignment_id = $submitted_assignment->comment_post_ID;
217 $submit_id = $submitted_assignment->comment_ID;
218
219 $max_mark = tutor_utils()->get_assignment_option($submitted_assignment->comment_post_ID, 'total_mark');
220 $pass_mark = tutor_utils()->get_assignment_option($submitted_assignment->comment_post_ID, 'pass_mark');
221 $given_mark = get_comment_meta($submitted_assignment->comment_ID, 'assignment_mark', true);
222 ?>
223
224 <?php ob_start(); ?>
225
226 <div class="assignment-result-wrap">
227 <h4><?php echo sprintf(__('You received %s points out of %s', 'tutor'), "<span class='received-marks'>{$given_mark}</span>", "<span class='out-of-marks'>{$max_mark}</span>") ?></h4>
228 <h4 class="submitted-assignment-grade">
229 <?php _e('Your Grade is ', 'tutor'); ?>
230 <?php if ($given_mark >= $pass_mark) {
231 ?>
232 <span class="submitted-assignment-grade-pass">
233 <?php _e('Passed', 'tutor'); ?>
234 </span>
235 <?php
236 } else {
237 ?>
238 <span class="submitted-assignment-grade-failed">
239 <?php _e('Failed', 'tutor'); ?>
240 </span>
241 <?php
242 } ?>
243 </h4>
244 </div>
245
246 <?php echo apply_filters('tutor_assignment/single/results/after', ob_get_clean(), $submit_id, $assignment_id); ?>
247
248 <?php } ?>
249
250 <div class="tutor-assignments-submitted-answers-wrap">
251
252 <h2><?php _e('Your Answers', 'tutor'); ?></h2>
253
254 <?php echo nl2br(stripslashes($submitted_assignment->comment_content));
255
256 $attached_files = get_comment_meta($submitted_assignment->comment_ID, 'uploaded_attachments', true);
257 if ($attached_files) {
258 $attached_files = json_decode($attached_files, true);
259
260 if (tutor_utils()->count($attached_files)) {
261
262 ?>
263 <h2><?php _e('Your uploaded file(s)', 'tutor'); ?></h2>
264
265 <?php
266 $upload_dir = wp_get_upload_dir();
267 $upload_baseurl = trailingslashit(tutor_utils()->array_get('baseurl', $upload_dir));
268 foreach ($attached_files as $attached_file) {
269 ?>
270 <div class="uploaded-files">
271 <a href="<?php echo $upload_baseurl . tutor_utils()->array_get('uploaded_path', $attached_file) ?>" target="_blank"><?php echo tutor_utils()->array_get('name', $attached_file); ?>
272 </a>
273 </div>
274 <?php
275 }
276 }
277 }
278
279 if ($is_reviewed_by_instructor) {
280 ?>
281
282 <div class="instructor-note-wrap">
283 <h2><?php _e('Instructor Note', 'tutor'); ?></h2>
284 <p><?php echo nl2br(get_comment_meta($submitted_assignment->comment_ID, 'instructor_note', true)) ?></p>
285 </div>
286 <?php
287 }
288 ?>
289 </div>
290
291 <?php
292 } else { ?>
293 <div class="tutor-assignment-start-btn-wrap">
294 <form action="" method="post" id="tutor_assignment_start_form">
295 <?php wp_nonce_field(tutor()->nonce_action, tutor()->nonce); ?>
296 <input type="hidden" value="tutor_assignment_start_submit" name="tutor_action" />
297 <input type="hidden" name="assignment_id" value="<?php echo get_the_ID(); ?>">
298 <button type="submit" class="tutor-button" id="tutor_assignment_start_btn" <?php if ($time_duration['value'] != 0) { if ($now > $remaining_time) {echo "disabled"; } } ?>>
299 <?php _e('Submit assignment', 'tutor'); ?>
300 </button>
301 </form>
302 </div>
303 <?php
304 }
305 }
306 ?>
307
308 <?php tutor_next_previous_pagination(); ?>
309
310 </div>
311
312 <?php do_action('tutor_assignment/single/after/content'); ?>