course = sloodle_get_record('course', 'id', $id)) error('Could not find course.'); $this->sloodle_course = new SloodleCourse(); if (!$this->sloodle_course->load($this->course)) error(get_string('failedcourseload', 'sloodle')); } /** * Check that the user is logged-in and has permission to alter course settings. */ function check_permission() { // Ensure the user logs in require_login($this->course->id); if (isguestuser()) error(get_string('noguestaccess', 'sloodle')); add_to_log($this->course->id, 'course', 'view sloodle data', '', "{$this->course->id}"); // Ensure the user is allowed to update information on this course $this->course_context = get_context_instance(CONTEXT_COURSE, $this->course->id); require_capability('moodle/course:update', $this->course_context); } /** * Print the course settings page header. */ function sloodle_print_header() { global $CFG; $navigation = "wwwroot}/mod/sloodle/view_logs.php?id={$this->course->id}\">".get_string('logs:view', 'sloodle').""; sloodle_print_header_simple(get_string('logs:view','sloodle'), " ", $navigation, "", "", true, '', false); } /** * Render the view of the module or feature. * This MUST be overridden to provide functionality. */ function render() { global $CFG; global $sloodle; // Display info about Sloodle course configuration echo "

".get_string('logs:sloodlelogs','sloodle')."

\n"; // sloodle_print_box(get_string('logs:info','sloodle'), 'generalbox boxaligncenter boxwidthnormal'); $sloodletable = new stdClass(); $sloodletable->head = array( '

'.get_string('avatarname', 'sloodle').'

', '

'.get_string('user').'

', '

'.get_string('action').'

', '

'.get_string('logs:slurl', 'sloodle').'

', '

'.get_string('logs:time', 'sloodle').'

'); //set alignment of table cells $sloodletable->align = array('left','left','left','left','left'); $sloodletable->width="95%"; //set size of table cells $sloodletable->size = array('15%','10%', '50%','5%','20%'); $logData = sloodle_get_records('sloodle_logs','course',$this->sloodle_course->get_course_id(), 'timemodified DESC'); if ($logData && count($logData)>0){ foreach ($logData as $ld){ $trowData= Array(); $link_url=' '.$ld->avname.""; $trowData[]=$link_url; $userData = sloodle_get_record('user','id',$ld->userid); $username= $userData->firstname.' '.$userData->lastname; $trowData[]=$username; $trowData[]=$ld->action; $trowData[]=''.get_string('logs:slurl', 'sloodle').''; $trowData[]=date("F j, Y, g:i a",$ld->timemodified); $sloodletable->data[] = $trowData; }//for } else { $trowData[]=get_string('logs:nologs', 'sloodle'); $sloodletable->data[] = $trowData; } sloodle_print_table($sloodletable); } /** * Print the footer for this course. */ function sloodle_print_footer() { global $CFG; echo "

wwwroot}/course/view.php?id={$this->course->id}\"><<< ".get_string('backtocoursepage','sloodle').""; sloodle_print_footer($this->course); } } ?>