public function Course::getTracker in Course 7.2
Same name and namespace in other branches
- 6 includes/course.core.inc \Course::getTracker()
- 7 includes/Course.inc \Course::getTracker()
Get the course tracker for this course/user.
Return value
File
- includes/
Course.inc, line 29
Class
- Course
- An object that holds CourseObjects and tracker functions?
Code
public function getTracker($account = NULL) {
// If no user object is supplied, the tracking is for the current user.
if (empty($account)) {
$account = $GLOBALS['user'];
}
if ($entities = entity_load('course_report', FALSE, array(
'nid' => $this
->getNode()->nid,
'uid' => $account->uid,
))) {
return reset($entities);
}
else {
return entity_create('course_report', array(
'nid' => $this
->getNode()->nid,
'uid' => $account->uid,
));
}
}