dirroot/files/mimetypes.php"); /*** Constants **********************************/ $WORKSHOP_TYPE = array (0 => get_string("notgraded", "workshop"), 1 => get_string("accumulative", "workshop"), 2 => get_string("errorbanded", "workshop"), 3 => get_string("criterion", "workshop"), 4 => get_string("rubric", "workshop") ); $WORKSHOP_SHOWGRADES = array (0 => get_string("dontshowgrades", "workshop"), 1 => get_string("showgrades", "workshop") ); $WORKSHOP_SCALES = array( 0 => array( 'name' => get_string("scaleyes", "workshop"), 'type' => 'radio', 'size' => 2, 'start' => get_string("yes"), 'end' => get_string("no")), 1 => array( 'name' => get_string("scalepresent", "workshop"), 'type' => 'radio', 'size' => 2, 'start' => get_string("present", "workshop"), 'end' => get_string("absent", "workshop")), 2 => array( 'name' => get_string("scalecorrect", "workshop"), 'type' => 'radio', 'size' => 2, 'start' => get_string("correct", "workshop"), 'end' => get_string("incorrect", "workshop")), 3 => array( 'name' => get_string("scalegood3", "workshop"), 'type' => 'radio', 'size' => 3, 'start' => get_string("good", "workshop"), 'end' => get_string("poor", "workshop")), 4 => array( 'name' => get_string("scaleexcellent4", "workshop"), 'type' => 'radio', 'size' => 4, 'start' => get_string("excellent", "workshop"), 'end' => get_string("verypoor", "workshop")), 5 => array( 'name' => get_string("scaleexcellent5", "workshop"), 'type' => 'radio', 'size' => 5, 'start' => get_string("excellent", "workshop"), 'end' => get_string("verypoor", "workshop")), 6 => array( 'name' => get_string("scaleexcellent7", "workshop"), 'type' => 'radio', 'size' => 7, 'start' => get_string("excellent", "workshop"), 'end' => get_string("verypoor", "workshop")), 7 => array( 'name' => get_string("scale10", "workshop"), 'type' => 'selection', 'size' => 10), 8 => array( 'name' => get_string("scale20", "workshop"), 'type' => 'selection', 'size' => 20), 9 => array( 'name' => get_string("scale100", "workshop"), 'type' => 'selection', 'size' => 100)); $WORKSHOP_EWEIGHTS = array( 0 => -4.0, 1 => -2.0, 2 => -1.5, 3 => -1.0, 4 => -0.75, 5 => -0.5, 6 => -0.25, 7 => 0.0, 8 => 0.25, 9 => 0.5, 10 => 0.75, 11=> 1.0, 12 => 1.5, 13=> 2.0, 14 => 4.0); $WORKSHOP_FWEIGHTS = array( 0 => 0, 1 => 0.1, 2 => 0.25, 3 => 0.5, 4 => 0.75, 5 => 1.0, 6 => 1.5, 7 => 2.0, 8 => 3.0, 9 => 5.0, 10 => 7.5, 11=> 10.0); if (!defined("COMMENTSCALE")) { define("COMMENTSCALE", 20); } /*** Standard Moodle functions ****************** function workshop_add_instance($workshop) function workshop_update_instance($workshop) function workshop_delete_instance($id) function workshop_user_outline($course, $user, $mod, $workshop) function workshop_user_complete($course, $user, $mod, $workshop) function workshop_cron () function workshop_print_recent_activity(&$logs, $isteacher=false) function workshop_grades($workshopid) **********************************************/ function workshop_add_instance($workshop) { // Given an object containing all the necessary data, // (defined by the form in mod.html) this function // will create a new instance and return the id number // of the new instance. $workshop->timemodified = time(); $workshop->deadline = make_timestamp($workshop->deadlineyear, $workshop->deadlinemonth, $workshop->deadlineday, $workshop->deadlinehour, $workshop->deadlineminute); return insert_record("workshop", $workshop); } function workshop_choose_from_menu ($options, $name, $selected="", $nothing="choose", $script="", $nothingvalue="0", $return=false) { /// Given an array of value, creates a popup menu to be part of a form /// $options["value"]["label"] if ($nothing == "choose") { $nothing = get_string("choose")."..."; } if ($script) { $javascript = "onChange=\"$script\""; } else { $javascript = ""; } $output = "
\n"; echo " \n"; echo "\n"; // get the assignment elements... if (!$elementsraw = get_records("workshop_elements", "workshopid", $workshop->id, "elementno ASC")) { print_string("noteonassignmentelements", "workshop"); } else { foreach ($elementsraw as $element) { $elements[] = $element; // to renumber index 0,1,2... } } if ($assessment) { // get any previous grades... if ($gradesraw = get_records_select("workshop_grades", "assessmentid = $assessment->id", "elementno")) { foreach ($gradesraw as $grade) { $grades[] = $grade; // to renumber index 0,1,2... } } } else { // setup dummy grades array for($i = 0; $i < count($elementsraw); $i++) { // gives a suitable sized loop $grades[$i]->feedback = get_string("yourfeedbackgoeshere", "workshop"); $grades[$i]->grade = 0; } } // determine what sort of grading switch ($workshop->gradingstrategy) { case 0: // no grading // now print the form for ($i=0; $i < count($elements); $i++) { $iplus1 = $i+1; echo "\n"; echo " \n"; echo " \n"; echo "\n"; echo " \n"; echo " \n"; echo "\n"; echo "\n"; echo " \n"; echo "\n"; } break; case 1: // accumulative grading // now print the form for ($i=0; $i < count($elements); $i++) { $iplus1 = $i+1; echo "\n"; echo " \n"; echo " \n"; if ($showgrades) { echo "\n"; echo " \n"; echo " \n"; echo "\n"; } echo "\n"; echo " \n"; echo " \n"; echo "\n"; echo "\n"; echo " \n"; echo "\n"; } break; case 2: // error banded grading // now run through the elements $negativecount = 0; for ($i=0; $i < count($elements) - 1; $i++) { $iplus1 = $i+1; echo "\n"; echo " \n"; echo " \n"; echo "\n"; echo " \n"; echo " \n"; echo "\n"; echo "\n"; echo " \n"; echo " \n"; echo "\n"; echo "\n"; echo " \n"; echo "\n"; if (empty($grades[$i]->grade)) { $negativecount++; } } // print the number of negative elements // echo "\n"; // echo "\n"; // echo " \n"; echo "
cellheading2\">
".get_string("assessment", "workshop"). "

". get_string("element","workshop")." $iplus1:

".text_to_html($elements[$i]->description); echo "

". get_string("feedback").":

\n"; if ($allowchanges) { echo " \n"; } else { echo text_to_html($grades[$i]->feedback); } echo "
cellheading2\"> 

". get_string("element","workshop")." $iplus1:

".text_to_html($elements[$i]->description); echo "

Weight: " .number_format($WORKSHOP_EWEIGHTS[$elements[$i]->weight], 2)."\n"; echo "

". get_string("grade"). ":

\n"; // get the appropriate scale $scalenumber=$elements[$i]->scale; $SCALE = (object)$WORKSHOP_SCALES[$scalenumber]; switch ($SCALE->type) { case 'radio' : // show selections highest first echo "
$SCALE->start   "; for ($j = $SCALE->size - 1; $j >= 0 ; $j--) { $checked = false; if (isset($grades[$i]->grade)) { if ($j == $grades[$i]->grade) { $checked = true; } } else { // there's no previous grade so check the lowest option if ($j == 0) { $checked = true; } } if ($checked) { echo "    \n"; } else { echo "    \n"; } } echo "   $SCALE->end
\n"; break; case 'selection' : unset($numbers); for ($j = $SCALE->size; $j >= 0; $j--) { $numbers[$j] = $j; } if (isset($grades[$i]->grade)) { choose_from_menu($numbers, "grade[$i]", $grades[$i]->grade, ""); } else { choose_from_menu($numbers, "grade[$i]", 0, ""); } break; } echo "

". get_string("feedback").":

\n"; if ($allowchanges) { echo " \n"; } else { echo text_to_html($grades[$i]->feedback); } echo "
cellheading2\"> 

". get_string("element","workshop")." $iplus1:

".text_to_html($elements[$i]->description); echo "

Weight: " .number_format($WORKSHOP_EWEIGHTS[$elements[$i]->weight], 2)."\n"; echo "

". get_string("grade"). ":

\n"; // get the appropriate scale - yes/no scale (0) $SCALE = (object) $WORKSHOP_SCALES[0]; switch ($SCALE->type) { case 'radio' : // show selections highest first echo "
$SCALE->start   "; for ($j = $SCALE->size - 1; $j >= 0 ; $j--) { $checked = false; if (isset($grades[$i]->grade)) { if ($j == $grades[$i]->grade) { $checked = true; } } else { // there's no previous grade so check the lowest option if ($j == 0) { $checked = true; } } if ($checked) { echo "    \n"; } else { echo "    \n"; } } echo "   $SCALE->end
\n"; break; case 'selection' : unset($numbers); for ($j = $SCALE->size; $j >= 0; $j--) { $numbers[$j] = $j; } if (isset($grades[$i]->grade)) { choose_from_menu($numbers, "grade[$i]", $grades[$i]->grade, ""); } else { choose_from_menu($numbers, "grade[$i]", 0, ""); } break; } echo "

". get_string("feedback").":

\n"; if ($allowchanges) { echo " \n"; } else { if (isset($grades[$i]->feedback)) { echo text_to_html($grades[$i]->feedback); } } echo " 
cellheading2\"> 
".get_string("numberofnegativeitems", "workshop")."$negativecount
cellheading2\"> 
\n"; // now print the grade table echo "

".get_string("gradetable","workshop")."
\n"; echo "
\n"; for ($j = 100; $j >= 0; $j--) { $numbers[$j] = $j; } for ($i=0; $i<=$workshop->nelements; $i++) { if ($i == $negativecount) { echo "\n"; } else { echo "\n"; } } echo "
". get_string("numberofnegativeresponses", "workshop"); echo "". get_string("suggestedgrade", "workshop")."
$i{$elements[$i]->maxscore}
$i{$elements[$i]->maxscore}
\n"; echo "

\n"; break; case 3: // criteria grading echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; // find which criteria has been selected (saved in the zero element), if any if (isset($grades[0]->grade)) { $selection = $grades[0]->grade; } else { $selection = 0; } // now run through the elements for ($i=0; $i < count($elements); $i++) { $iplus1 = $i+1; echo "\n"; echo " \n"; if ($selection == $i) { echo " \n"; } else { echo " \n"; } echo "\n"; } echo "
".get_string("adjustment", "workshop")."\n"; unset($numbers); for ($j = 20; $j >= -20; $j--) { $numbers[$j] = $j; } if (isset($grades[$workshop->nelements]->grade)) { choose_from_menu($numbers, "grade[$workshop->nelements]", $grades[$workshop->nelements]->grade, ""); } else { choose_from_menu($numbers, "grade[$workshop->nelements]", 0, ""); } echo "
cellheading2\"> cellheading2\">". get_string("criterion","workshop")."cellheading2\">".get_string("select", "workshop")."cellheading2\">".get_string("suggestedgrade", "workshop")."
$iplus1".text_to_html($elements[$i]->description)."{$elements[$i]->maxscore}
\n"; echo "

\n"; break; case 4: // rubric grading // now run through the elements... for ($i=0; $i < count($elements); $i++) { $iplus1 = $i+1; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo " \n"; echo " \n"; if (isset($grades[$i])) { $selection = $grades[$i]->grade; } else { $selection = 0; } // ...and the rubrics if ($rubricsraw = get_records_select("workshop_rubrics", "workshopid = $workshop->id AND elementno = $i", "rubricno ASC")) { unset($rubrics); foreach ($rubricsraw as $rubic) { $rubrics[] = $rubic; // to renumber index 0,1,2... } for ($j=0; $j<5; $j++) { if (empty($rubrics[$j]->description)) { break; // out of inner for loop } echo "\n"; if ($selection == $j) { echo " \n"; }else { echo " \n"; } echo "\n"; } echo "\n"; echo " \n"; echo " \n"; echo "\n"; echo "\n"; echo " \n"; echo "\n"; } } break; } // end of outer switch // now get the general comment (present in all types) echo "\n"; echo " \n"; echo " \n"; echo "\n"; echo "\n"; echo " \n"; echo "\n"; $timenow = time(); // now show the teacher's comment if available... if ($assessment->timegraded and (($timenow - $assessment->timegraded) > $CFG->maxeditingtime)) { echo "\n"; echo " \n"; echo " \n"; echo "\n"; // only show the grading grade if it's the teacher if (isteacher($course->id)) { echo "\n"; echo " \n"; echo " \n"; echo "\n"; } echo "\n"; echo "\n"; echo "\n"; } // ...and close the table, show submit button if needed... echo "
".get_string("adjustment", "workshop")."\n"; unset($numbers); for ($j = 20; $j >= -20; $j--) { $numbers[$j] = $j; } if (isset($grades[1]->grade)) { choose_from_menu($numbers, "grade[1]", $grades[1]->grade, ""); } else { choose_from_menu($numbers, "grade[1]", 0, ""); } echo "
".get_string("element", "workshop")." $iplus1:".text_to_html($elements[$i]->description). "

Weight: " .number_format($WORKSHOP_EWEIGHTS[$elements[$i]->weight], 2)."

cellheading2\" align=\"center\">".get_string("select", "workshop")."cellheading2\">". get_string("criterion","workshop")."
".text_to_html($rubrics[$j]->description)."

". get_string("feedback").":

\n"; if ($allowchanges) { echo " \n"; } else { echo text_to_html($grades[$i]->feedback); } echo "
cellheading2\"> 

". get_string("generalcomment", "workshop").":

\n"; if ($allowchanges) { echo " \n"; } else { if ($assessment) { if (isset($assessment->generalcomment)) { echo text_to_html($assessment->generalcomment); } } else { print_string("yourfeedbackgoeshere", "workshop"); } } echo " 
cellheading2\"> 

". get_string("teacherscomment", "workshop").":

\n"; echo text_to_html($assessment->teachercomment); echo " 

". get_string("teachersgrade", "workshop").":

\n"; echo number_format($assessment->gradinggrade * 100 / COMMENTSCALE, 0)."%"; echo " 
cellheading2\"> 
\n"; if ($assessment) { if ($allowchanges) { echo "\n"; } // ...if user is author, assessment not agreed, there's no comments, the showcommentlinks flag is set and // it's not self assessment then show some buttons! if (($submission->userid == $USER->id) and !$assessment->timeagreed and !$comments and $showcommentlinks and $submission->userid != $assessment->userid) { echo "\n"; echo "\n"; } } echo "
"; echo "\n"; } function workshop_print_assessments_by_user_for_admin($workshop, $user) { if ($assessments =workshop_get_user_assessments($workshop, $user)) { foreach ($assessments as $assessment) { echo "

".get_string("assessmentby", "workshop", $user->firstname." ".$user->lastname)."

\n"; workshop_print_assessment($workshop, $assessment); echo "

id&aid=$assessment->id\">". get_string("delete", "workshop")."


\n"; } } } function workshop_print_assessments_for_admin($workshop, $submission) { if ($assessments =workshop_get_assessments($submission)) { foreach ($assessments as $assessment) { if (!$user = get_record("user", "id", $assessment->userid)) { error (" workshop_print_assessments_for_admin: unable to get user record"); } echo "

".get_string("assessmentby", "workshop", $user->firstname." ".$user->lastname)."

\n"; workshop_print_assessment($workshop, $assessment); echo "

id&aid=$assessment->id\">". get_string("delete", "workshop")."


\n"; } } } function workshop_print_assignment_info($workshop) { if (! $course = get_record("course", "id", $workshop->course)) { error("Course is misconfigured"); } if (! $cm = get_coursemodule_from_instance("workshop", $workshop->id, $course->id)) { error("Course Module ID was incorrect"); } // print standard assignment heading $strdifference = format_time($workshop->deadline - time()); if (($workshop->deadline - time()) < 0) { $strdifference = "$strdifference"; } $strduedate = userdate($workshop->deadline)." ($strdifference)"; print_simple_box_start("center"); print_heading($workshop->name, "center"); print_simple_box_start("center"); echo "".get_string("duedate", "assignment").": $strduedate
"; echo "".get_string("maximumgrade").": $workshop->grade
"; echo "".get_string("detailsofassessment", "workshop").": id&action=displaygradingform\">". get_string("specimenassessmentform", "workshop")."
"; print_simple_box_end(); echo "
"; echo format_text($workshop->description, $workshop->format); print_simple_box_end(); echo "
"; } function workshop_print_difference($time) { if ($time < 0) { $timetext = get_string("late", "assignment", format_time($time)); return " ($timetext)"; } else { $timetext = get_string("early", "assignment", format_time($time)); return " ($timetext)"; } } function workshop_print_feedback($course, $submission) { global $CFG, $THEME, $RATING; if (! $teacher = get_record("user", "id", $submission->teacher)) { error("Weird workshop error"); } echo "\n
"; echo "\n"; echo "\n"; echo "\n"; echo ""; echo "\n
body\" WIDTH=35 VALIGN=TOP>"; print_user_picture($teacher->id, $course->id, $teacher->picture); echo "cellheading\">$teacher->firstname $teacher->lastname"; echo "  ".userdate($submission->timemarked).""; echo "
cellcontent\">"; echo "

"; if ($submission->grade) { echo get_string("grade").": $submission->grade"; } else { echo get_string("nograde"); } echo "

"; echo text_to_html($submission->assessorcomment); echo "
"; echo "
"; } function workshop_print_league_table($workshop) { // print an order table of (student) submissions showing teacher's and student's assessments if (! $course = get_record("course", "id", $workshop->course)) { error("Print league table: Course is misconfigured"); } $table->head = array (get_string("title", "workshop"), get_string("name"), get_string("teacherassessments", "workshop", $course->teacher), get_string("studentassessments", "workshop", $course->student), get_string("overallgrade", "workshop")); $table->align = array ("left", "left", "center", "center", "center"); $table->size = array ("*", "*", "*", "*", "*"); $table->cellpadding = 2; $table->cellspacing = 0; if ($submissions = workshop_get_student_submissions($workshop, "grade")) { foreach ($submissions as $submission) { if (!$user = get_record("user", "id", $submission->userid)) { error("Print league table: user not found"); } $table->data[] = array(workshop_print_submission_title($workshop, $submission), $user->firstname." ". $user->lastname, workshop_print_submission_assessments($workshop, $submission, "teacher"), workshop_print_submission_assessments($workshop, $submission, "student"), number_format(($workshop->teacherweight * $submission->teachergrade + $workshop->peerweight * $submission->peergrade) / ($workshop->teacherweight + $workshop->peerweight), 1)) ; } print_heading(get_string("leaguetable", "workshop")); print_table($table); } } function workshop_print_submission_assessments($workshop, $submission, $type) { // Returns the teacher or peer grade and a hyperlinked list of grades for this submission $str = ''; if ($assessments = workshop_get_assessments($submission)) { switch ($type) { case "teacher" : if ($submission->teachergrade) { // if there's a final teacher's grade... $str = "$submission->teachergrade "; } foreach ($assessments as $assessment) { if (isteacher($workshop->course, $assessment->userid)) { $str .= "id&aid=$assessment->id\">["; $str .= number_format($assessment->grade, 0)."%"; if ($assessment->gradinggrade) { // funny, teacher is grading self! $str .= "/".number_format($assessment->gradinggrade*100/COMMENTSCALE, 0)."%"; } $str .= "] "; } } break; case "student" : if ($submission->peergrade) { // if there's a final peer grade... $str = "$submission->peergrade "; } foreach ($assessments as $assessment) { if (isstudent($workshop->course, $assessment->userid)) { $str .= "id&aid=$assessment->id\">{"; $str .= number_format($assessment->grade, 0)."%"; if ($assessment->gradinggrade) { $str .= "/".number_format($assessment->gradinggrade*100/COMMENTSCALE, 0)."%"; } $str .= "} "; } } break; } } if (!$str) { $str = " "; // be kind to Mozilla browsers! } return $str; } function workshop_print_submission_title($workshop, $submission) { // Arguments are objects global $CFG; if (!$submission->timecreated) { // a "no submission" return $submission->title; } $filearea = workshop_file_area_name($workshop, $submission); if ($basedir = workshop_file_area($workshop, $submission)) { if (list($file) = get_directory_list($basedir)) { $icon = mimeinfo("icon", $file); if ($CFG->slasharguments) { $ffurl = "file.php/$filearea/$file"; } else { $ffurl = "file.php?file=/$filearea/$file"; } return "wwwroot/files/pix/$icon\" HEIGHT=16 WIDTH=16 BORDER=0 ALT=\"File\">". " wwwroot/$ffurl\">$submission->title"; } } } function workshop_print_tabbed_heading($tabs) { // Prints a tabbed heading where one of the tabs highlighted. // $tabs is an object with several properties. // $tabs->names is an array of tab names // $tabs->urls is an array of links // $tabs->align is an array of column alignments (defaults to "center") // $tabs->size is an array of column sizes // $tabs->wrap is an array of "nowrap"s or nothing // $tabs->highlight is an index (zero based) of "active" heading . // $tabs->width is an percentage of the page (defualts to 80%) // $tabs->cellpadding padding on each cell (defaults to 5) global $CFG, $THEME; if (isset($tabs->names)) { foreach ($tabs->names as $key => $name) { if (!empty($tabs->urls[$key])) { $url =$tabs->urls[$key]; if ($tabs->highlight == $key) { $tabcontents[$key] = "$name"; } else { $tabcontents[$key] = "$name"; } } else { $tabcontents[$key] = "$name"; } } } if (empty($tabs->width)) { $tabs->width = "80%"; } if (empty($tabs->cellpadding)) { $tabs->cellpadding = "5"; } // print_simple_box_start("center", "$table->width", "#ffffff", 0); echo "cellpadding\" cellspacing=\"0\" class=\"generaltable\">\n"; if (!empty($tabs->names)) { echo ""; echo "\n"; foreach ($tabcontents as $key => $tab) { if (isset($align[$key])) { $alignment = "align=\"$align[$key]\""; } else { $alignment = "align=\"center\""; } if (isset($size[$key])) { $width = "width=\"$size[$key]\""; } else { $width = ""; } if (isset($wrap[$key])) { $wrapping = "no wrap"; } else { $wrapping = ""; } if ($key == $tabs->highlight) { echo "\n"; } else { echo "\n"; } echo "\n"; } echo "\n"; } else { echo "\n"; } // bottom stripe $ncells = count($tabs->names)*2 +1; $height = 2; echo "\n"; echo "
". "wwwroot/pix/spacer.gif\" alt=\"\">cellheading2\">$tabbody\">$tab". "wwwroot/pix/spacer.gif\" alt=\"\">
No names specified
cellheading2\">". "wwwroot/pix/spacer.gif\" alt=\"\">
\n"; // print_simple_box_end(); return true; } function workshop_print_time_to_deadline($time) { if ($time < 0) { $timetext = get_string("afterdeadline", "workshop", format_time($time)); return " ($timetext)"; } else { $timetext = get_string("beforedeadline", "workshop", format_time($time)); return " ($timetext)"; } } function workshop_print_upload_form($workshop) { // Arguments are objects, needs title coming in echo "
"; echo "
"; echo " maxbytes\">"; echo " id\">"; echo "".get_string("title", "workshop").":

\n"; echo " "; echo " "; echo "
"; echo "
"; } function workshop_print_user_assessments($workshop, $user) { // Returns the number of assessments and a hyperlinked list of grading grades for the assessments made by this user if ($assessments = workshop_get_user_assessments($workshop, $user)) { $n = count($assessments); $str = "$n ("; foreach ($assessments as $assessment) { if ($assessment->timegraded) { $gradingscaled = intval($assessment->gradinggrade * $workshop->grade / COMMENTSCALE); $str .= "id&aid=$assessment->id\">"; $str .= "$gradingscaled "; } else { $str .= "id&aid=$assessment->id\">"; $str .= "- "; } } $str .= ")"; } else { $str ="0"; } return $str; } function workshop_test_user_assessments($workshop, $user) { // see if user has assessed required number of assessments of teachers submissions... global $CFG; $result = true; $n = 0; $timenow =time(); if ($submissions = workshop_get_teacher_submissions($workshop)) { foreach ($submissions as $submission) { if ($assessment = workshop_get_submission_assessment($submission, $user)) { // ...the date stamp on the assessment should be in the past if ($assessment->timecreated < $timenow) { $n++; } } } if ($n < min($workshop->ntassessments, workshop_count_teacher_submissions($workshop))) { $result = false; } } return $result; } function workshop_get_participants($workshopid) { //Returns the users with data in one workshop //(users with records in workshop_submissions, workshop_assessments and workshop_comments, students) global $CFG; //Get students from workshop_submissions $st_submissions = get_records_sql("SELECT DISTINCT u.* FROM {$CFG->prefix}user u, {$CFG->prefix}workshop_submissions s WHERE s.workshopid = '$workshopid' and u.id = s.userid"); //Get students from workshop_assessments $st_assessments = get_records_sql("SELECT DISTINCT u.* FROM {$CFG->prefix}user u, {$CFG->prefix}workshop_assessments a WHERE a.workshopid = '$workshopid' and u.id = a.userid"); //Get students from workshop_comments $st_comments = get_records_sql("SELECT DISTINCT u.* FROM {$CFG->prefix}user u, {$CFG->prefix}workshop_comments c WHERE c.workshopid = '$workshopid' and u.id = c.userid"); //Add st_assessments to st_submissions if ($st_assessments) { foreach ($st_assessments as $st_assessment) { $st_submissions[$st_assessment->id] = $st_assessment; } } //Add st_comments to st_submissions if ($st_comments) { foreach ($st_comments as $st_comment) { $st_submissions[$st_comment->id] = $st_comment; } } //Return st_submissions array (it contains an array of unique users) return ($st_submissions); } ?>