function show_student_assignments() { global $tool_content, $m, $uid, $course_id, $course_code, $langDaysLeft, $langDays, $langNoAssign, $urlServer, $course_code, $themeimg, $langAutoJudgeRank; $gids = user_group_info($uid, $course_id); if (!empty($gids)) { $gids_sql_ready = implode(',', array_keys($gids)); } else { $gids_sql_ready = "''"; } $result = Database::get()->queryArray("SELECT *, CAST(UNIX_TIMESTAMP(deadline)-UNIX_TIMESTAMP(NOW()) AS SIGNED) AS time\n FROM assignment WHERE course_id = ?d AND active = 1 AND\n (assign_to_specific = 0 OR assign_to_specific = 1 AND id IN\n (SELECT assignment_id FROM assignment_to_specific WHERE user_id = ?d UNION SELECT assignment_id FROM assignment_to_specific WHERE group_id IN ({$gids_sql_ready}))\n )\n ORDER BY CASE WHEN CAST(deadline AS UNSIGNED) = '0' THEN 1 ELSE 0 END, deadline", $course_id, $uid); if (count($result) > 0) { $tool_content .= "\n <div class='row'><div class='col-sm-12'>\n <div class='table-responsive'><table class='table-default'>\n <tr>\n <th>{$m['title']}</th>\n <th class='text-center'>{$m['deadline']}</th>\n <th class='text-center'>{$m['submitted']}</th>\n <th>{$m['grade']}</th>\n <th>{$langAutoJudgeRank}</th>\n </tr>"; $k = 0; foreach ($result as $row) { $title_temp = q($row->title); $test = (int) $row->deadline; $rankreportlink = "rank_report.php?course={$course_code}&assignment={$row->id}"; if ((int) $row->deadline) { $deadline = nice_format($row->deadline, true); } else { $deadline = $m['no_deadline']; } $tool_content .= "\n <tr>\n <td><a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&id={$row->id}'>{$title_temp}</a></td>\n <td width='150' class='text-center'>" . $deadline; if ($row->time > 0) { $tool_content .= "<br> (<span>{$langDaysLeft}" . format_time_duration($row->time) . ")</span>"; } else { if ((int) $row->deadline) { $tool_content .= "<br> (<span class='expired'>{$m['expired']}</span>)"; } } $tool_content .= "</td><td width='170' align='center'>"; if ($submission = find_submissions(is_group_assignment($row->id), $uid, $row->id, $gids)) { foreach ($submission as $sub) { if (isset($sub->group_id)) { // if is a group assignment $tool_content .= "<div style='padding-bottom: 5px;padding-top:5px;font-size:9px;'>({$m['groupsubmit']} " . "<a href='../group/group_space.php?course={$course_code}&group_id={$sub->group_id}'>" . "{$m['ofgroup']} " . gid_to_name($sub['group_id']) . "</a>)</div>"; } $tool_content .= icon('fa-check-square-o', $m['yes']) . "<br>"; } } else { $tool_content .= icon('fa-square-o', $m['no']); } $tool_content .= "</td>\n <td width='30' align='center'>"; $rankcontent = ""; foreach ($submission as $sub) { $grade = submission_grade($sub->id); if (!$grade) { $grade = "<div style='padding-bottom: 5px;padding-top:5px;'> - </div>"; } $tool_content .= "<div style='padding-bottom: 5px;padding-top:5px;'>{$grade}</div>"; if ($grade) { $rankcontent = "<div style='padding-bottom: 5px;padding-top:10px;'><a href='" . $rankreportlink . "'>" . icon('fa-sort-alpha-asc') . "</a></div>"; } } $tool_content .= "</td><td class='option-btn-cell' align='center'>{$rankcontent}</td>\n </tr>"; $k++; } $tool_content .= ' </table></div></div></div>'; } else { $tool_content .= "<div class='alert alert-warning'>{$langNoAssign}</div>"; } }
function show_student_assignments() { global $tool_content, $m, $uid, $course_id, $course_code, $langDaysLeft, $langDays, $langNoAssign, $urlServer, $course_code, $themeimg, $langEditChange; $gids = user_group_info($uid, $course_id); if (!empty($gids)) { $gids_sql_ready = implode(',',array_keys($gids)); } else { $gids_sql_ready = "''"; } $result = Database::get()->queryArray("SELECT *, CAST(UNIX_TIMESTAMP(deadline)-UNIX_TIMESTAMP(NOW()) AS SIGNED) AS time FROM assignment WHERE course_id = ?d AND active = '1' AND (assign_to_specific = '0' OR assign_to_specific = '1' AND id IN (SELECT assignment_id FROM assignment_to_specific WHERE user_id = ?d UNION SELECT assignment_id FROM assignment_to_specific WHERE group_id IN ($gids_sql_ready)) ) ORDER BY CASE WHEN CAST(deadline AS UNSIGNED) = '0' THEN 1 ELSE 0 END, deadline", $course_id, $uid); if (count($result)>0) { $tool_content .= " <div class='row'><div class='col-sm-12'> <div class='table-responsive'><table class='table-default'> <tr class='list-header'> <th style='width:45%'>$m[title]</th> <th class='text-center' style='width:25%'>$m[deadline]</th> <th class='text-center'>$m[submitted]</th> <th class='text-center'>$m[grade]</th> </tr>"; $k = 0; foreach ($result as $row) { $title_temp = q($row->title); if($row->deadline){ $deadline = nice_format($row->deadline, true); }else{ $deadline = $m['no_deadline']; } $tool_content .= " <tr> <td><a href='$_SERVER[SCRIPT_NAME]?course=$course_code&id=$row->id'>$title_temp</a></td> <td class='text-center'>" . $deadline ; if ($row->time > 0) { $tool_content .= "<br>(<small>$langDaysLeft" . format_time_duration($row->time) . "</small>)"; } else if($row->deadline){ $tool_content .= "<br> (<small><span class='expired'>$m[expired]</span></small>)"; } $tool_content .= "</td><td class='text-center'>"; if ($submission = find_submissions(is_group_assignment($row->id), $uid, $row->id, $gids)) { foreach ($submission as $sub) { if (isset($sub->group_id)) { // if is a group assignment $tool_content .= "<div style='padding-bottom: 5px;padding-top:5px;font-size:9px;'>($m[groupsubmit] " . "<a href='../group/group_space.php?course=$course_code&group_id=$sub->group_id'>" . "$m[ofgroup] " . gid_to_name($sub->group_id) . "</a>)</div>"; } $tool_content .= "<i class='fa fa-check-square-o'></i><br>"; } } else { $tool_content .= "<i class='fa fa-square-o'></i><br>"; } $tool_content .= "</td> <td width='30' align='center'>"; foreach ($submission as $sub) { $grade = submission_grade($sub->id); if (!$grade) { $grade = "<div style='padding-bottom: 5px;padding-top:5px;'> - </div>"; } $tool_content .= "<div style='padding-bottom: 5px;padding-top:5px;'>$grade</div>"; } $tool_content .= "</td> </tr>"; $k++; } $tool_content .= ' </table></div></div></div>'; } else { $tool_content .= "<div class='alert alert-warning'>$langNoAssign</div>"; } }