<commit_before><?php // $Id$

    require("../../config.php");
    require("lib.php");
    require("locallib.php");

    require_variable($id);   // course

    if (! $course = get_record("course", "id", $id)) {
        error("Course ID is incorrect");
    }

    require_login($course->id);
    add_to_log($course->id, "workshop", "view all", "index.php?id=$course->id", "");

    $strworkshops = get_string("modulenameplural", "workshop");
    $strworkshop = get_string("modulename", "workshop");
    $strweek = get_string("week");
    $strtopic = get_string("topic");
    $strname = get_string("name");
    if (isstudent($course->id)) {
        $strinfo = get_string("grade");
    } else {
        $strinfo = get_string("phase", "workshop");
    }
    $strdeadline = get_string("deadline", "workshop");
    $strsubmitted = get_string("submitted", "assignment");

    print_header_simple("$strworkshops", "", "$strworkshops", "", "", true, "", navmenu($course));

    if (! $workshops = get_all_instances_in_course("workshop", $course)) {
        notice("There are no workshops", "../../course/view.php?id=$course->id");
        die;
    }

    $timenow = time();

    if ($course->format == "weeks") {
        $table->head  = array ($strweek, $strname, $strinfo, $strsubmitted, $strdeadline);
        $table->align = array ("CENTER", "LEFT", "LEFT", "LEFT", "LEFT");
    } elseif ($course->format == "topics") {
        $table->head  = array ($strtopic, $strname, $strinfo, $strsubmitted, $strdeadline);
        $table->align = array ("CENTER", "LEFT", "left", "LEFT", "LEFT");
    } else {
        $table->head  = array ($strname, $strinfo, $strsubmitted, $strdeadline);
        $table->align = array ("LEFT", "LEFT", "LEFT", "LEFT");
    }

    foreach ($workshops as $workshop) {
        switch ($workshop->phase) {
            case 0:
            case 1: $info = get_string("phase1short", "workshop");
                    break;
            case 2: $info = get_string("phase2short", "workshop");
                    break;
            case 3: $info = get_string("phase3short", "workshop");
                    break;
            case 4: $info = get_string("phase4short", "workshop");
                    break;
            case 5: $info = get_string("phase5short", "workshop");
                    break;
        }
        if ($submissions = workshop_get_user_submissions($workshop, $USER)) {
            foreach ($submissions as $submission) {
                if ($submission->timecreated <= $workshop->deadline) {
                    $submitted = userdate($submission->timecreated);
                } 
                else {
                    $submitted = "<font color=\"red\">".userdate($submission->timecreated)."</font>";
                }
                $due = userdate($workshop->deadline);
                if (!$workshop->visible) {
                    //Show dimmed if the mod is hidden
                    $link = "<a class=\"dimmed\" href=\"view.php?id=$workshop->coursemodule\">$workshop->name</a><br />";
                } else {
                    //Show normal if the mod is visible
                    $link = "<a href=\"view.php?id=$workshop->coursemodule\">$workshop->name</a><br />";
                }
                if (isstudent($course->id)) {
                    $link .= " ($submission->title)"; // show students the title of their submission(s)
                    $gradinggrade = workshop_gradinggrade($workshop, $USER);
                    $grade = workshop_submission_grade($workshop, $submission);
                    if ($workshop->wtype) {
                        $info = get_string("gradeforassessments", "workshop").
                            ": $gradinggrade/$workshop->gradinggrade; ".get_string("gradeforsubmission", "workshop").
                            ": $grade/$workshop->grade";
                    } else { // simple assignemnt, don't show grading grade 
                        $info = get_string("gradeforsubmission", "workshop").": $grade/$workshop->grade";
                    }<commit_msg>On the Workshops submissions with no assessments are flagged as such rather than given a zero grade.<commit_after><?php // $Id$

    require("../../config.php");
    require("lib.php");
    require("locallib.php");

    require_variable($id);   // course

    if (! $course = get_record("course", "id", $id)) {
        error("Course ID is incorrect");
    }

    require_login($course->id);
    add_to_log($course->id, "workshop", "view all", "index.php?id=$course->id", "");

    $strworkshops = get_string("modulenameplural", "workshop");
    $strworkshop = get_string("modulename", "workshop");
    $strweek = get_string("week");
    $strtopic = get_string("topic");
    $strname = get_string("name");
    if (isstudent($course->id)) {
        $strinfo = get_string("grade");
    } else {
        $strinfo = get_string("phase", "workshop");
    }
    $strdeadline = get_string("deadline", "workshop");
    $strsubmitted = get_string("submitted", "assignment");

    print_header_simple("$strworkshops", "", "$strworkshops", "", "", true, "", navmenu($course));

    if (! $workshops = get_all_instances_in_course("workshop", $course)) {
        notice("There are no workshops", "../../course/view.php?id=$course->id");
        die;
    }

    $timenow = time();

    if ($course->format == "weeks") {
        $table->head  = array ($strweek, $strname, $strinfo, $strsubmitted, $strdeadline);
        $table->align = array ("CENTER", "LEFT", "LEFT", "LEFT", "LEFT");
    } elseif ($course->format == "topics") {
        $table->head  = array ($strtopic, $strname, $strinfo, $strsubmitted, $strdeadline);
        $table->align = array ("CENTER", "LEFT", "left", "LEFT", "LEFT");
    } else {
        $table->head  = array ($strname, $strinfo, $strsubmitted, $strdeadline);
        $table->align = array ("LEFT", "LEFT", "LEFT", "LEFT");
    }

    foreach ($workshops as $workshop) {
        switch ($workshop->phase) {
            case 0:
            case 1: $info = get_string("phase1short", "workshop");
                    break;
            case 2: $info = get_string("phase2short", "workshop");
                    break;
            case 3: $info = get_string("phase3short", "workshop");
                    break;
            case 4: $info = get_string("phase4short", "workshop");
                    break;
            case 5: $info = get_string("phase5short", "workshop");
                    break;
        }
        if ($submissions = workshop_get_user_submissions($workshop, $USER)) {
            foreach ($submissions as $submission) {
                if ($submission->timecreated <= $workshop->deadline) {
                    $submitted = userdate($submission->timecreated);
                } 
                else {
                    $submitted = "<font color=\"red\">".userdate($submission->timecreated)."</font>";
                }
                $due = userdate($workshop->deadline);
                if (!$workshop->visible) {
                    //Show dimmed if the mod is hidden
                    $link = "<a class=\"dimmed\" href=\"view.php?id=$workshop->coursemodule\">$workshop->name</a><br />";
                } else {
                    //Show normal if the mod is visible
                    $link = "<a href=\"view.php?id=$workshop->coursemodule\">$workshop->name</a><br />";
                }
                if (isstudent($course->id)) {
                    $link .= " ($submission->title)"; // show students the title of their submission(s)
                    $gradinggrade = workshop_gradinggrade($workshop, $USER);
                    $grade = workshop_submission_grade($workshop, $submission);
                    if ($workshop->wtype) {
                        if (workshop_count_assessments($submission)) {
                            $info = get_string("gradeforassessments", "workshop").
                                ": $gradinggrade/$workshop->gradinggrade; ".get_string("gradeforsubmission", 
                                "workshop").": $grade/$workshop->grade";
                        } else {
                            $info = get_string("gradeforassessments", "workshop").
                                ": $gradinggrade/$workshop->gradinggrade; ".get_string("gradeforsubmission", 
                                "workshop").": ".get_string("noassessments", "workshop");
                        }
                     } else { // simple assignemnt, don't show grading grade 
                        $info = get_string("gradeforsubmission", "workshop").": $grade/$workshop->grade";
                    }
{'fraction_non_alphanumeric': 0.16800092818192366, 'fraction_numerical': 0.002552500290056851, 'mean_word_length': 2.042710907165549, 'pattern_counts': {'":': 8, '<': 23, '<?xml version=': 0, '>': 80, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2721651', 'n_tokens_mistral': 2508, 'n_tokens_neox': 2403, 'n_words': 485}