Source for file sloodlecourseobject.php
Documentation is available at sloodlecourseobject.php
* sloodlecourseobject provides basic functionality for accessing information about
* the students, including a student list, and avatar list
* @copyright Copyright (c) 2008 Sloodle (various contributors)
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU GPL v3
* @see http://slisweb.sjsu.edu/sl/index.php/Sloodle_Stipend_Giver
* @contributer Paul Preibisch - aka Fire Centaur
/** SLOODLE course data structure */
require_once(SLOODLE_DIRROOT.
'/view/base/base_view_module.php');
* URL for accessing the current course.
* Full name of the current course.
* Short name of the current course.
if(!$this->cm =
get_coursemodule_from_id('sloodle',$id)) error ('Course module ID was incorrect.');
$this->courseContext =
get_context_instance(CONTEXT_MODULE, $this->cm->id);
if (!$this->courseRec =
get_record('course', 'id', $this->cm->course)) error('Failed to retrieve course.');
//set sloodle course object
$this->courseContext =
get_record('context','instanceid',(int)
$this->cm->instance);
// Fetch the SLOODLE instance itself
if (!$this->sloodleRec =
get_record('sloodle', 'id', $this->cm->instance)) error('Failed to find SLOODLE module instance');
//set sloodleId (id of module instance)
return get_records('sloodle_users', 'userid', $userid);
//returns a list of avatars in the class
foreach ($userList as $u){
$sloodledata =
get_records('sloodle_users', 'userid', $u->id);
foreach ($sloodledata as $sd){
$av->username =
$u->username;
$av->avname =
$sd->avname;
$context =
get_context_instance(CONTEXT_MODULE, $this->cm->id);
if (has_capability('moodle/course:manageactivities',$context, $userid)) {
//get all the users from the users table in the moodle database
$sql =
"select u.*, ra.roleid from ".
$CFG->prefix.
"role_assignments ra, ".
$CFG->prefix.
"context con, ".
$CFG->prefix.
"course c, ".
$CFG->prefix.
"user u ";
$sql .=
" where ra.userid=u.id and ra.contextid=con.id and con.instanceid=c.id and c.id=".
$this->cm->course;
$fullUserList =
get_records_sql($sql);
* setUserList set's the private userList array
// Construct URLs to this user's Moodle and SLOODLE profile pages
$url_moodleprofile =
$CFG->wwwroot.
"/user/view.php?id={$u->id}&course={
$this->courseId}";
return $url_moodleprofile;
function get_sloodleprofile($u){
$url_sloodleprofile = SLOODLE_WWWROOT."/view.php?_type=user&id={
$u->id}&course={
$this->courseId}";
return $url_sloodleprofile;
Documentation generated on Fri, 17 Jul 2009 11:02:28 +0100 by phpDocumentor 1.4.0