function workshop_print_recent_activity($course, $viewfullanmes, $timestart) { global $CFG; $isteacher = has_capability('mod/workshop:manage', get_context_instance(CONTEXT_COURSE, $course->id)); $modinfo = get_fast_modinfo($course); // have a look for agreed assessments for this user (agree) $agreecontent = false; if (!$isteacher) { // teachers only need to see submissions if ($logs = workshop_get_agree_logs($course, $timestart)) { $agreecontent = true; print_headline(get_string("workshopagreedassessments", "workshop") . ":"); foreach ($logs as $log) { if (!workshop_is_teacher($workshop, $log->userid)) { // don't break anonymous rule $log->firstname = $course->student; $log->lastname = ''; } print_recent_activity_note($log->time, $log, $log->name, $CFG->wwwroot . '/mod/workshop/' . $log->url); } } } // have a look for new assessments for this user (assess) $assesscontent = false; if (!$isteacher) { // teachers only need to see submissions if ($logs = workshop_get_assess_logs($course, $timestart)) { // got some, see if any belong to a visible module foreach ($logs as $id => $log) { $cm = $modinfo->instances['workshop'][$log->workshopid]; if (!$cm->uservisible) { unset($logs[$id]); continue; } } // if we got some "live" ones then output them if ($logs) { $assesscontent = true; print_headline(get_string("workshopassessments", "workshop") . ":"); foreach ($logs as $log) { if (!workshop_is_teacher($tempmod->id, $log->userid)) { // don't break anonymous rule $log->firstname = $course->student; // Keep anonymous $log->lastname = ''; } print_recent_activity_note($log->time, $log, $log->name, $CFG->wwwroot . '/mod/workshop/' . $log->url); } } } } // have a look for new comments for this user (comment) $commentcontent = false; if (!$isteacher) { // teachers only need to see submissions if ($logs = workshop_get_comment_logs($course, $timestart)) { // got some, see if any belong to a visible module foreach ($logs as $id => $log) { $cm = $modinfo->instances['workshop'][$log->workshopid]; if (!$cm->uservisible) { unset($logs[$id]); continue; } } // if we got some "live" ones then output them if ($logs) { $commentcontent = true; print_headline(get_string("workshopcomments", "workshop") . ":"); foreach ($logs as $log) { $log->firstname = $course->student; // Keep anonymous $log->lastname = ''; print_recent_activity_note($log->time, $log, $log->name, $CFG->wwwroot . '/mod/workshop/' . $log->url); } } } } // have a look for new assessment gradings for this user (grade) $gradecontent = false; if ($logs = workshop_get_grade_logs($course, $timestart)) { // got some, see if any belong to a visible module foreach ($logs as $id => $log) { $cm = $modinfo->instances['workshop'][$log->workshopid]; if (!$cm->uservisible) { unset($logs[$id]); continue; } } // if we got some "live" ones then output them if ($logs) { $gradecontent = true; print_headline(get_string("workshopfeedback", "workshop") . ":"); foreach ($logs as $log) { $log->firstname = $course->teacher; // Keep anonymous $log->lastname = ''; print_recent_activity_note($log->time, $log, $log->name, $CFG->wwwroot . '/mod/workshop/' . $log->url); } } } // have a look for new submissions (only show to teachers) (submit) $submitcontent = false; if ($isteacher) { if ($logs = workshop_get_submit_logs($course, $timestart)) { // got some, see if any belong to a visible module foreach ($logs as $id => $log) { $cm = $modinfo->instances['workshop'][$log->workshopid]; if (!$cm->uservisible) { unset($logs[$id]); continue; } } // if we got some "live" ones then output them if ($logs) { $submitcontent = true; print_headline(get_string("workshopsubmissions", "workshop") . ":"); foreach ($logs as $log) { print_recent_activity_note($log->time, $log, $log->name, $CFG->wwwroot . '/mod/workshop/' . $log->url); } } } } return $agreecontent or $assesscontent or $commentcontent or $gradecontent or $submitcontent; }
function workshop_print_recent_activity($course, $isteacher, $timestart) { global $CFG; // have a look for agreed assessments for this user (agree) $agreecontent = false; if (!$isteacher) { // teachers only need to see submissions if ($logs = workshop_get_agree_logs($course, $timestart)) { // got some, see if any belong to a visible module foreach ($logs as $log) { // Create a temp valid module structure (only need courseid, moduleid) $tempmod->course = $course->id; $tempmod->id = $log->workshopid; //Obtain the visible property from the instance if (instance_is_visible("workshop", $tempmod)) { $agreecontent = true; break; } } // if we got some "live" ones then output them if ($agreecontent) { print_headline(get_string("workshopagreedassessments", "workshop") . ":"); foreach ($logs as $log) { //Create a temp valid module structure (only need courseid, moduleid) $tempmod->course = $course->id; $tempmod->id = $log->workshopid; //Obtain the visible property from the instance if (instance_is_visible("workshop", $tempmod)) { if (!workshop_is_teacher($workshop, $log->userid)) { // don't break anonymous rule $log->firstname = $course->student; $log->lastname = ''; } print_recent_activity_note($log->time, $log, $log->name, $CFG->wwwroot . '/mod/workshop/' . $log->url); } } } } } // have a look for new assessments for this user (assess) $assesscontent = false; if (!$isteacher) { // teachers only need to see submissions if ($logs = workshop_get_assess_logs($course, $timestart)) { // got some, see if any belong to a visible module foreach ($logs as $log) { // Create a temp valid module structure (only need courseid, moduleid) $tempmod->course = $course->id; $tempmod->id = $log->workshopid; //Obtain the visible property from the instance if (instance_is_visible("workshop", $tempmod)) { $assesscontent = true; break; } } // if we got some "live" ones then output them if ($assesscontent) { print_headline(get_string("workshopassessments", "workshop") . ":"); foreach ($logs as $log) { //Create a temp valid module structure (only need courseid, moduleid) $tempmod->course = $course->id; $tempmod->id = $log->workshopid; //Obtain the visible property from the instance if (instance_is_visible("workshop", $tempmod)) { if (!workshop_is_teacher($tempmod->id, $log->userid)) { // don't break anonymous rule $log->firstname = $course->student; $log->lastname = ''; } print_recent_activity_note($log->time, $log, $log->name, $CFG->wwwroot . '/mod/workshop/' . $log->url); } } } } } // have a look for new comments for this user (comment) $commentcontent = false; if (!$isteacher) { // teachers only need to see submissions if ($logs = workshop_get_comment_logs($course, $timestart)) { // got some, see if any belong to a visible module foreach ($logs as $log) { // Create a temp valid module structure (only need courseid, moduleid) $tempmod->course = $course->id; $tempmod->id = $log->workshopid; //Obtain the visible property from the instance if (instance_is_visible("workshop", $tempmod)) { $commentcontent = true; break; } } // if we got some "live" ones then output them if ($commentcontent) { print_headline(get_string("workshopcomments", "workshop") . ":"); foreach ($logs as $log) { //Create a temp valid module structure (only need courseid, moduleid) $tempmod->course = $course->id; $tempmod->id = $log->workshopid; //Obtain the visible property from the instance if (instance_is_visible("workshop", $tempmod)) { $log->firstname = $course->student; // Keep anonymous $log->lastname = ''; print_recent_activity_note($log->time, $log, $log->name, $CFG->wwwroot . '/mod/workshop/' . $log->url); } } } } } // have a look for new assessment gradings for this user (grade) $gradecontent = false; if ($logs = workshop_get_grade_logs($course, $timestart)) { // got some, see if any belong to a visible module foreach ($logs as $log) { // Create a temp valid module structure (only need courseid, moduleid) $tempmod->course = $course->id; $tempmod->id = $log->workshopid; //Obtain the visible property from the instance if (instance_is_visible("workshop", $tempmod)) { $gradecontent = true; break; } } // if we got some "live" ones then output them if ($gradecontent) { print_headline(get_string("workshopfeedback", "workshop") . ":"); foreach ($logs as $log) { //Create a temp valid module structure (only need courseid, moduleid) $tempmod->course = $course->id; $tempmod->id = $log->workshopid; //Obtain the visible property from the instance if (instance_is_visible("workshop", $tempmod)) { $log->firstname = $course->teacher; // Keep anonymous $log->lastname = ''; print_recent_activity_note($log->time, $log, $log->name, $CFG->wwwroot . '/mod/workshop/' . $log->url); } } } } // have a look for new submissions (only show to teachers) (submit) $submitcontent = false; if ($isteacher) { if ($logs = workshop_get_submit_logs($course, $timestart)) { // got some, see if any belong to a visible module foreach ($logs as $log) { // Create a temp valid module structure (only need courseid, moduleid) $tempmod->course = $course->id; $tempmod->id = $log->workshopid; //Obtain the visible property from the instance if (instance_is_visible("workshop", $tempmod)) { $submitcontent = true; break; } } // if we got some "live" ones then output them if ($submitcontent) { print_headline(get_string("workshopsubmissions", "workshop") . ":"); foreach ($logs as $log) { //Create a temp valid module structure (only need courseid, moduleid) $tempmod->course = $course->id; $tempmod->id = $log->workshopid; //Obtain the visible property from the instance if (instance_is_visible("workshop", $tempmod)) { print_recent_activity_note($log->time, $log, $log->name, $CFG->wwwroot . '/mod/workshop/' . $log->url); } } } } } return $agreecontent or $assesscontent or $commentcontent or $gradecontent or $submitcontent; }