예제 #1
0
function show_edit_form($id, $sid, $assign)
{
    global $m, $langGradeOk, $tool_content, $course_code;
    $sub = Database::get()->querySingle("SELECT * FROM assignment_submit WHERE id = ?d", $sid);
    if (count($sub) > 0) {
        $uid_2_name = display_user($sub->uid);
        if (!empty($sub->group_id)) {
            $group_submission = "({$m['groupsubmit']} " . "<a href='../group/group_space.php?course={$course_code}&amp;group_id={$sub->group_id}'>" . "{$m['ofgroup']} " . gid_to_name($sub->group_id) . "</a>)";
        } else {
            $group_submission = '';
        }
        $tool_content .= "\n                <form method='post' action='index.php?course={$course_code}'>\n                <input type='hidden' name='assignment' value='{$id}'>\n                <input type='hidden' name='submission' value='{$sid}'>\n                <fieldset>\n                <legend>{$m['addgradecomments']}</legend>\n                <table width='99%' class='tbl'>\n                <tr>\n                    <th class='left' width='180'>{$m['username']}:</th>\n                    <td>{$uid_2_name} " . q($group_submission) . "</td>\n                </tr>\n                <tr>\n                    <th class='left'>{$m['sub_date']}:</th>\n                    <td>" . q($sub->submission_date) . "</td></tr>\n                <tr>\n                    <th class='left'>{$m['filename']}:</th>\n                    <td><a href='index.php?course={$course_code}&amp;get={$sub->id}'>" . q($sub->file_name) . "</a></td>\n                </tr>\n                <tr>\n                    <th class='left'>{$m['grade']}:</th>\n                    <td><input type='text' name='grade' maxlength='3' size='3' value='" . q($sub->grade) . "'></td></tr>\n                <tr>\n                    <th class='left'>{$m['gradecomments']}:</th>\n                    <td><textarea cols='60' rows='3' name='comments'>" . q($sub->grade_comments) . "</textarea></td>\n                </tr>\n                <tr>\n                    <th><label for='email_button'>{$m['email_users']}:</label></th>\n                    <td><input type='checkbox' value='1' id='email_button' name='email'></td>\n                </tr>\n                <tr>\n                    <th class='left'>&nbsp;</th>\n                    <td><input class='btn btn-primary' type='submit' name='grade_comments' value='{$langGradeOk}'></td>\n                </tr>\n                </table>\n                </fieldset>\n                </form><br>";
    } else {
        Session::Messages($m['WorkNoSubmission'], 'alert-danger');
        redirect_to_home_page('modules/work/index.php?course=' . $course_code . '&id=' . $id);
    }
}
예제 #2
0
if (!$uid or !$courses[$course_code]) {
    forbidden();
}

initialize_group_id();
initialize_group_info($group_id);

$toolName = $langGroups;
$pageName = $group_name;
$navigation[] = array('url' => 'index.php?course=' . $course_code, 'name' => $langGroups);

if (isset($_GET['selfReg'])) {
    if (!$is_member and $status != USER_GUEST and ($max_members == 0 or $member_count < $max_members)) {
        $id = Database::get()->query("INSERT INTO group_members SET user_id = ?d, group_id = ?d, description = ''", $uid, $group_id);
        $group = gid_to_name($group_id);
        Log::record($course_id, MODULE_ID_GROUPS, LOG_MODIFY, array('id' => $id,
            'uid' => $uid,
            'name' => $group));

        Session::Messages($langGroupNowMember, 'alert-success');
        redirect_to_home_page("modules/group/group_space.php?course=$course_code&group_id=$group_id");
    } else {
        $tool_content .= "<div class='alert alert-danger'>$langForbidden</div>";
        draw($tool_content, 2);
        exit;
    }
}
if (!$is_member and !$is_editor) {
    $tool_content .= "<div class='alert alert-danger'>$langForbidden</div>";
    draw($tool_content, 2);
예제 #3
0
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}&amp;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}&amp;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}&amp;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>";
    }
}
예제 #4
0
/**
 * @brief Print a box with the details of a bbb session
 * @global type $course_id
 * @global type $tool_content
 * @global type $is_editor
 * @global type $langNewBBBSessionStart
 * @global type $langNewBBBSessionType
 * @global type $langConfirmDelete
 * @global type $langNewBBBSessionPublic
 * @global type $langNewBBBSessionPrivate
 * @global type $langBBBSessionJoin
 * @global type $langNewBBBSessionDesc
 * @global type $course_code
 * @global type $langNote
 * @global type $langBBBNoteEnableJoin
 * @global type $langTitle
 * @global type $langActivate
 * @global type $langDeactivate
 * @global type $langModify
 * @global type $langDelete
 */
function bbb_session_details() {
    global $course_id, $tool_content, $is_editor, $course_code, $head_content,
        $langNewBBBSessionStart, $langNewBBBSessionType, $langParticipants,
        $langConfirmDelete, $langNewBBBSessionPublic, $langNewBBBSessionPrivate,
        $langBBBSessionJoin, $langNewBBBSessionDesc, $langNote,
        $langBBBNoteEnableJoin, $langTitle,$langActivate, $langDeactivate,
        $langEditChange, $langDelete, $langNoBBBSesssions, $langDaysLeft, $m,
        $langBBBNotServerAvailableStudent, $langBBBNotServerAvailableTeacher,
        $langBBBImportRecordings;

    load_js('trunk8');

    $myGroups = Database::get()->queryArray("SELECT group_id FROM group_members WHERE user_id=?d", $_SESSION['uid']);

    $activeClause = $is_editor? '': "AND active = '1'";
    $result = Database::get()->queryArray("SELECT * FROM bbb_session
        WHERE course_id = ?s $activeClause ORDER BY start_date DESC", $course_id);
    if (get_total_bbb_servers() == '0') {
        if ($is_editor) {
            $tool_content .= "<p class='alert alert-danger'><b>$langNote</b>:<br />$langBBBNotServerAvailableTeacher</p>";
        } else {
            $tool_content .= "<p class='alert alert-danger'><b>$langNote</b>:<br />$langBBBNotServerAvailableStudent</p>";
        }
    } elseif ($result) {
        if (!$is_editor) {
            $tool_content .= "<div class='alert alert-info'><label>$langNote</label>:<br>$langBBBNoteEnableJoin</div>";
        }
        $headingsSent = false;
        $headings = "<div class='row'>
                       <div class='col-md-12'>
                         <div class='table-responsive'>
                           <table class='table-default'>
                             <tr class='list-header'>
                               <th style='width:25%'>$langTitle</th>
                               <th class='text-center'>$langNewBBBSessionDesc</th>
                               <th class='text-center'>$langNewBBBSessionStart</th>
                               <th class='text-center'>$langParticipants</th>
                               <th class='text-center'>".icon('fa-gears')."</th>
                             </tr>";

        define('DAY_MINUTES', 24 * 40);
        foreach ($result as $row) {
            $participants = '';
            // Get participants
            $r_group = explode(",",$row->participants);
            foreach ($r_group as $participant_uid) {
                if ($participants) {
                    $participants .= ', ';
                }
                $participant_uid = str_replace("'", '', $participant_uid);
                if (preg_match('/^_/', $participant_uid)) {
                    $participants .= gid_to_name(str_replace("_", '', $participant_uid));
                } else {
                    $participants .= uid_to_name($participant_uid, 'fullname');
                }
            }
            $participants = "<span class='trunk8'>$participants</span>";
            $id = $row->id;
            $title = $row->title;
            $start_date = $row->start_date;
            $timeLeft = date_diff_in_minutes($start_date, date('Y-m-d H:i:s'));
            $timeLabel = $start_date;
            if ($timeLeft > 0) {
                $timeLabel .= "<br><span class='label label-warning'><small>$langDaysLeft " .
                    format_time_duration($timeLeft * 60) .
                    "</small></span>";
            } elseif (-$timeLeft > DAY_MINUTES) {
                $timeLabel .= "<br><span class='label label-danger'><small>$m[expired]</small></span>";
            }

            // $row->public == '1' ? $type = $langNewBBBSessionPublic: $type = $langNewBBBSessionPrivate;
            $meeting_id = $row->meeting_id;
            $att_pw = $row->att_pw;
            $mod_pw = $row->mod_pw;
            $record = $row->record;
            $desc = isset($row->description)? $row->description: '';

            $canJoin = $row->active == '1' &&
                $timeLeft < $row->unlock_interval &&
                -$timeLeft < DAY_MINUTES &&
                get_total_bbb_servers() <> '0';
            if ($canJoin) {
                if($is_editor)
                {
                    $joinLink = "<a href='$_SERVER[SCRIPT_NAME]?course=$course_code&amp;choice=do_join&amp;meeting_id=" . urlencode($meeting_id) . "&amp;title=".urlencode($title)."&amp;att_pw=".urlencode($att_pw)."&amp;mod_pw=".urlencode($mod_pw)."&amp;record=$record' target='_blank'>" . q($title) . "</a>";
                }else
                {
                    //$joinLink = "<a href='$_SERVER[SCRIPT_NAME]?course=$course_code&amp;choice=do_join&amp;meeting_id=" . urlencode($meeting_id) . "&amp;att_pw=".urlencode($att_pw)."' target='_blank'>" . q($title) . "</a>";
                    $joinLink = "<a href='$_SERVER[SCRIPT_NAME]?course=$course_code&amp;choice=do_join&amp;meeting_id=" . urlencode($meeting_id) . "&amp;title=".urlencode($title)."&amp;att_pw=".urlencode($att_pw)."&amp;record=$record' target='_blank'>" . q($title) . "</a>";
                }
            } else {
                $joinLink = q($title);
            }

            if ($is_editor) {
                if (!$headingsSent) {
                    $tool_content .= $headings;
                    $headingsSent = true;
                }
                $tool_content .= '<tr' . ($row->active? '': " class='not_visible'") . ">
                    <td class='text-left'>$joinLink</td>
                    <td>$desc</td>
                    <td class='text-center'>$timeLabel</td>
                    <td style='width: 30%'>$participants</td>
                    <td class='option-btn-cell'>".
                        action_button(array(
                            array(  'title' => $langEditChange,
                                    'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;id=" . getIndirectReference($id) . "&amp;choice=edit",
                                    'icon' => 'fa-edit'),
                            array(  'title' => $langBBBImportRecordings,
                                    'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;id=" . getIndirectReference($row->id) . "&amp;choice=import_video",
                                    'icon' => "fa-edit"),
                            array(  'title' => $row->active? $langDeactivate : $langActivate,
                                    'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;id=" . getIndirectReference($row->id) . "&amp;choice=do_".
                                             ($row->active? 'disable' : 'enable'),
                                    'icon' => $row->active ? 'fa-eye': 'fa-eye-slash'),
                            array(  'title' => $langDelete,
                                    'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;id=" . getIndirectReference($row->id) . "&amp;choice=do_delete",
                                    'icon' => 'fa-times',
                                    'class' => 'delete',
                                    'confirm' => $langConfirmDelete)
                            )) .
                    "</td></tr>";
            } else {
                // Allow access to session only if user is in participant group or session is scheduled for everyone
                $access = false;
                if(!empty($r_group) && count($r_group)>0 && $r_group[0]<>'')
                {
                    foreach ($myGroups as $mg) {
                        if (in_array("'_" . $mg->group_id . "'", $r_group)) {
                            $access = true;
                        }
                }
                }else{
                    $access = true;
                }
                // Always allow access to editor switched to student view
                $access = $access || in_array("'".$_SESSION['uid']."'", $r_group) ||
                    (isset($_SESSION['student_view']) and $_SESSION['student_view'] == $course_code);

                if ($access) {
                    if (!$headingsSent) {
                        $tool_content .= $headings;
                        $headingsSent = true;
                    }
                    $tool_content .= "<tr>
                        <td class='text-center'>$joinLink</td>
                        <td>$desc</td>
                        <td class='text-center'>$timeLabel</td>
                        <td style='width: 30%'>$participants</td>
                        <td class='text-center'>";
                    // Join url will be active only X minutes before scheduled time and if session is visible for users
                    if ($canJoin) {
                        $tool_content .= icon('fa-sign-in', $langBBBSessionJoin,"$_SERVER[SCRIPT_NAME]?course=$course_code&amp;choice=do_join&amp;title=".urlencode($title)."&amp;meeting_id=" . urlencode($meeting_id) . "&amp;att_pw=".urlencode($att_pw)."&amp;record=$record' target='_blank");
                    } else {
                        $tool_content .= "-</td>";
                    }
                    $tool_content .= "</tr>";
                }
            }
        }
        if ($headingsSent) {
            $tool_content .= "</table></div></div></div>";
        }

        if (get_total_bbb_servers() == '0') {
            if ($is_editor) {
                $tool_content .= "<p class='alert alert-danger'><b>$langNote</b>:<br />$langBBBNotServerAvailableTeacher</p>";
            } else {
                $tool_content .= "<p class='alert alert-danger'><b>$langNote</b>:<br />$langBBBNotServerAvailableStudent</p>";
            }
        }
        if (!$is_editor and !$headingsSent) {
            $tool_content .= "<div class='alert alert-warning'>$langNoBBBSesssions</div>";
        }
    } else {
        $tool_content .= "<div class='alert alert-warning'>$langNoBBBSesssions</div>";
    }
}
예제 #5
0
파일: index.php 프로젝트: nikosv/openeclass
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&amp;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&amp;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>";
    }
}
예제 #6
0
function show_edit_form($id, $sid, $assign) {
    global $m, $langGradeOk, $tool_content, $course_code, $langCancel,
           $langBack, $assign, $langWorkOnlineText, $course_id;
    $sub = Database::get()->querySingle("SELECT * FROM assignment_submit WHERE id = ?d",$sid);
    if (count($sub)>0) {
        $uid_2_name = display_user($sub->uid);
        if (!empty($sub->group_id)) {
            $group_submission = "($m[groupsubmit] $m[ofgroup] " .
                    "<a href='../group/group_space.php?course=$course_code&amp;group_id=$sub->group_id'>"
                     . gid_to_name($sub->group_id) . "</a>)";
        } else {
            $group_submission = '';
        }

        $grade = Session::has('grade') ? Session::get('grade') : $sub->grade;
        $comments = Session::has('comments') ? Session::get('comments') : q($sub->grade_comments);
        $email_status = !Session::has('email') ?: " checked";

        $pageName = $m['addgradecomments'];
        if($assign->submission_type){
            $submission = "
                    <div class='form-group'>
                        <label class='col-sm-3 control-label'>$langWorkOnlineText:</label>
                        <div class='col-sm-9'>
                            $sub->submission_text
                        </div>
                    </div>";
        } else {
            $submission = "
                    <div class='form-group'>
                        <label class='col-sm-3 control-label'>$m[filename]:</label>
                        <div class='col-sm-9'>
                            <a href='index.php?course=$course_code&amp;get=$sub->id'>".q($sub->file_name)."</a>
                        </div>
                    </div>";
        }
        if ($assign->grading_scale_id) {
            $serialized_scale_data = Database::get()->querySingle('SELECT scales FROM grading_scale WHERE id = ?d AND course_id = ?d', $assign->grading_scale_id, $course_id)->scales;
            $scales = unserialize($serialized_scale_data);
            $scale_options = "<option value> - </option>";
            $scale_values = array_value_recursive('scale_item_value', $scales);
            if (!in_array($sub->grade, $scale_values) && !is_null($sub->grade)) {
                $sub->grade = closest($sub->grade, $scale_values)['value'];
            }
            foreach ($scales as $scale) {
                $scale_options .= "<option value='$scale[scale_item_value]'".($sub->grade == $scale['scale_item_value'] ? " selected" : "").">$scale[scale_item_name]</option>";
            }
            $grade_field = "
                    <select name='grade' class='form-control' id='scales'>
                        $scale_options
                    </select>";
        } else {
            $grade_field = "<input class='form-control' type='text' name='grade' maxlength='4' size='3' value='$sub->grade'> ($m[max_grade]: $assign->max_grade)";
        }
        $tool_content .= action_bar(array(
                array(
                    'title' => $langBack,
                    'url' => "index.php?course=$course_code&id=$sub->assignment_id",
                    'icon' => "fa-reply",
                    'level' => 'primary-label'
                )
            ))."
            <div class='form-wrapper'>
                <form class='form-horizontal' role='form' method='post' action='index.php?course=$course_code'>
                <input type='hidden' name='assignment' value='$id'>
                <input type='hidden' name='submission' value='$sid'>
                <fieldset>
                    <div class='form-group'>
                        <label class='col-sm-3 control-label'>$m[username]:</label>
                        <div class='col-sm-9'>
                        $uid_2_name $group_submission
                        </div>
                    </div>
                    <div class='form-group'>
                        <label class='col-sm-3 control-label'>$m[sub_date]:</label>
                        <div class='col-sm-9'>
                            <span>".q($sub->submission_date)."</span>
                        </div>
                    </div>
                    $submission
                    <div class='form-group".(Session::getError('grade') ? " has-error" : "")."'>
                        <label for='grade' class='col-sm-3 control-label'>$m[grade]:</label>
                        <div class='col-sm-4'>
                            $grade_field
                            <span class='help-block'>".(Session::hasError('grade') ? Session::getError('grade') : "")."</span>
                        </div>
                    </div>
                    <div class='form-group'>
                        <label for='comments' class='col-sm-3 control-label'>$m[gradecomments]:</label>
                        <div class='col-sm-9'>
                            <textarea class='form-control' rows='3' name='comments'  id='comments'>$comments</textarea>
                        </div>
                    </div>
                    <div class='form-group'>
                        <div class='col-sm-9 col-sm-offset-3'>
                            <div class='checkbox'>
                                <label>
                                    <input type='checkbox' value='1' id='email_button' name='email'$email_status>
                                    $m[email_users]
                                </label>
                            </div>
                        </div>
                    </div>
                    <div class='form-group'>
                        <div class='col-sm-9 col-sm-offset-3'>
                            <input class='btn btn-primary' type='submit' name='grade_comments' value='$langGradeOk'>
                            <a class='btn btn-default' href='index.php?course=$course_code&id=$sub->assignment_id'>$langCancel</a>
                        </div>
                    </div>
                </fieldset>
                </form>
            </div>";
    } else {
        Session::Messages($m['WorkNoSubmission'], 'alert-danger');
        redirect_to_home_page('modules/work/index.php?course='.$course_code.'&id='.$id);
    }
}
예제 #7
0
function show_submission_details($id)
{
    global $uid, $m, $langSubmittedAndGraded, $tool_content, $course_code, $langAutoJudgeEnable, $langAutoJudgeShowWorkResultRpt;
    $sub = Database::get()->querySingle("SELECT * FROM assignment_submit WHERE id = ?d", $id);
    if (!$sub) {
        die("Error: submission {$id} doesn't exist.");
    }
    if (!empty($sub->grade) or !empty($sub->grade_comment)) {
        $graded = TRUE;
        $notice = $langSubmittedAndGraded;
    } else {
        $graded = FALSE;
        $notice = $GLOBALS['langSubmitted'];
    }
    if ($sub->uid != $uid) {
        $notice .= "<br>{$m['submitted_by_other_member']} " . "<a href='../group/group_space.php?course={$course_code}&amp;group_id={$sub->group_id}'>" . "{$m['your_group']} " . gid_to_name($sub->group_id) . "</a> (" . display_user($sub->uid) . ")";
    } elseif ($sub->group_id) {
        $notice .= "<br>{$m['groupsubmit']} " . "<a href='../group/group_space.php?course={$course_code}&amp;group_id={$sub->group_id}'>" . "{$m['ofgroup']} " . gid_to_name($sub->group_id) . "</a>";
    }
    $reportlink = "work_result_rpt.php?course={$course_code}&amp;assignment={$sub->assignment_id}&amp;submission={$sub->id}";
    $tool_content .= "\n        <fieldset>\n        <legend>{$m['SubmissionWorkInfo']}</legend>\n        <table class='tbl'>\n\t<tr>\n\t  <th width='150'>{$m['SubmissionStatusWorkInfo']}:</th>\n\t  <td valign='top'>{$notice}</td>\n\t</tr>\n        <tr>\n          <th>" . $m['grade'] . ":</th>\n          <td>" . $sub->grade . "</td>\n        </tr>\n        <tr>\n          <th valign='top'>" . $m['gradecomments'] . ":</th>\n          <td>" . $sub->grade_comments . "</td>\n        </tr>\n        <tr>\n          <th>" . $m['sub_date'] . ":</th>\n          <td>" . $sub->submission_date . "</td>\n        </tr>\n        <tr>\n          <th>" . $m['filename'] . ":</th>\n          <td><a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;get={$sub->id}'>" . q($sub->file_name) . "</a></td>\n        </tr>\n         <th> {$langAutoJudgeEnable}:</th>\n          <td><a href='{$reportlink}'> {$langAutoJudgeShowWorkResultRpt}</a></td>\n        </tr>";
    table_row($m['comments'], $sub->comments, true);
    $tool_content .= "\n        </table>\n        </fieldset>";
}
예제 #8
0
function show_submission_details($id) {
    global $uid, $m, $langSubmittedAndGraded, $tool_content, $course_code,
           $langAutoJudgeEnable, $langAutoJudgeShowWorkResultRpt;
    $sub = Database::get()->querySingle("SELECT * FROM assignment_submit WHERE id = ?d", $id);
    if (!$sub) {
        die("Error: submission $id doesn't exist.");
    }
    if (!empty($sub->grade) or !empty($sub->grade_comment)) {
        $graded = TRUE;
        $notice = $langSubmittedAndGraded;
    } else {
        $graded = FALSE;
        $notice = $GLOBALS['langSubmitted'];
    }

    if ($sub->uid != $uid) {
        $notice .= "<br>$m[submitted_by_other_member] " .
                "<a href='../group/group_space.php?course=$course_code&amp;group_id=$sub->group_id'>" .
                "$m[your_group] " . gid_to_name($sub->group_id) . "</a> (" . display_user($sub->uid) . ")";
    } elseif ($sub->group_id) {
        $notice .= "<br>$m[groupsubmit] " .
                "<a href='../group/group_space.php?course=$course_code&amp;group_id=$sub->group_id'>" .
                "$m[ofgroup] " . gid_to_name($sub->group_id) . "</a>";
    }

    $tool_content .= "
        <div class='panel panel-default'>
            <div class='panel-heading list-header'>
                <h3 class='panel-title'>$m[SubmissionWorkInfo]</h3>
            </div>
            <div class='panel-body'>
                <div class='row margin-bottom-fat'>
                    <div class='col-sm-3'>
                        <strong>".$m['SubmissionStatusWorkInfo'].":</strong>
                    </div>
                    <div class='col-sm-9'>$notice
                    </div>
                </div>
                <div class='row margin-bottom-fat'>
                    <div class='col-sm-3'>
                        <strong>" . $m['grade'] . ":</strong>
                    </div>
                    <div class='col-sm-9'>" . $sub->grade . "
                    </div>
                </div>
                <div class='row margin-bottom-fat'>
                    <div class='col-sm-3'>
                        <strong>" . $m['gradecomments'] . ":</strong>
                    </div>
                    <div class='col-sm-9'>" . $sub->grade_comments . "
                    </div>
                </div>
                <div class='row margin-bottom-fat'>
                    <div class='col-sm-3'>
                        <strong>" . $m['sub_date'] . ":</strong>
                    </div>
                    <div class='col-sm-9'>" . $sub->submission_date . "
                    </div>
                </div>
                <div class='row margin-bottom-fat'>
                    <div class='col-sm-3'>
                        <strong>" . $m['filename'] . ":</strong>
                    </div>
                    <div class='col-sm-9'><a href='$_SERVER[SCRIPT_NAME]?course=$course_code&amp;get=$sub->id'>" . q($sub->file_name) . "</a>
                    </div>
                </div>";
                if(AutojudgeApp::getAutojudge()->isEnabled()) {
                $reportlink = "work_result_rpt.php?course=$course_code&amp;assignment=$sub->assignment_id&amp;submission=$sub->id";
                $tool_content .= "
                <div class='row margin-bottom-fat'>
                    <div class='col-sm-3'>
                        <strong>" . $langAutoJudgeEnable . ":</strong>
                    </div>
                    <div class='col-sm-9'><a href='$reportlink'> $langAutoJudgeShowWorkResultRpt</a>
                    </div>
                </div>";
                }
            table_row($m['comments'], $sub->comments, true);
$tool_content .= "
            </div>
        </div>
            ";
}