class CourseObjectFulfillment in Course 6
Same name and namespace in other branches
- 7.2 includes/CourseObjectFulfillment.inc \CourseObjectFulfillment
- 7 includes/CourseObjectFulfillment.inc \CourseObjectFulfillment
Parent class for course object fulfillment.
Represents the fulfillment record in the database.
Hierarchy
- class \CourseHandler
- class \CourseObjectFulfillment
Expanded class hierarchy of CourseObjectFulfillment
File
- includes/
course_object.core.inc, line 969
View source
class CourseObjectFulfillment extends CourseHandler {
private $courseObject;
/**
* Construct the fulfillment object.
*
* A CourseObject and user are required to construct a fulfillment object.
*
* @param CourseObject $courseObject
* @param Object $user
*/
function __construct(CourseObject $courseObject, $user) {
// Set storage.
$this->handlerType = 'course_object_fulfillment';
$this->table = 'course_outline_fulfillment';
$this->primaryKey = 'cofid';
$this->serializedField = 'info';
$this->courseObject = $courseObject;
$sql = "SELECT * FROM {course_outline_fulfillment} WHERE coid = %d AND uid = %d";
$fulfillment = db_fetch_array(db_query($sql, $this->courseObject
->getId(), $user->uid));
$this
->setOptions($fulfillment);
// Set course object ID.
$this
->setOption('coid', $this->courseObject
->getId());
$this
->setOption('uid', $user->uid);
}
/**
* Is this fulfillment complete?
*
* @return bool
*/
function isComplete() {
return (bool) $this
->getOption('complete');
}
/**
* Set this fulfillment complete.
*
* @param bool $complete
* Set to 0 to un-complete, 1 or omit to complete.
*/
function setComplete($complete = 1) {
if (!$this
->getOption('date_completed')) {
$this
->setOption('date_completed', time());
}
return $this
->setOption('complete', $complete);
}
/**
* Set this fulfillment's grade.
*
* @param float $grade
*/
function setGrade($grade) {
return $this
->setOption('grade_result', $grade);
}
/**
* Get this fulfillment's grade.
*
* @return float
* A float value of the user's grade for this fulfillment.
*/
function getGrade() {
return $this
->getOption('grade_result');
}
/**
* Get this fulfillment's course object.
*/
function getCourseObject() {
return $this->courseObject;
}
public function delete() {
$sql = "DELETE FROM {course_outline_fulfillment} WHERE cofid = %d";
db_query($sql, $this
->getId());
}
/**
* Track course after saving fulfillment.
*/
public function save() {
parent::save();
$this
->getCourseObject()
->getCourse()
->track();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CourseHandler:: |
private | property | ||
CourseHandler:: |
protected | property | ||
CourseHandler:: |
public | property | ||
CourseHandler:: |
public | property | ||
CourseHandler:: |
public | property | ||
CourseHandler:: |
public | property | ||
CourseHandler:: |
final public | function | Merge an array of options onto the existing options. | |
CourseHandler:: |
public | function | Get an array of access messages. | |
CourseHandler:: |
protected | function | Return an array of database fields. This determines what fields should be serialized instead of stored. | |
CourseHandler:: |
function | |||
CourseHandler:: |
final public | function | Get an option stored in this CourseObject. | |
CourseHandler:: |
public | function | Get an object's configuration. | 1 |
CourseHandler:: |
public | function | Stub. Get the summary of an object's options. | 1 |
CourseHandler:: |
public | function | Return a list of warning strings about this handler. | 1 |
CourseHandler:: |
protected | function | Handlers need to declare their defaults if they have a configuration form. | 4 |
CourseHandler:: |
public | function | Handlers can declare a form. | 4 |
CourseHandler:: |
private | function | Merge arrays with replace, not append. | |
CourseHandler:: |
public | function | Save data somewhere. | 1 |
CourseHandler:: |
public | function | Validate? | 3 |
CourseHandler:: |
public | function | Set an access message to be displayed along with the course object when it is in the outline. For example, "This activity will open on XYZ" or "Please complete Step 1 to take this activity." | |
CourseHandler:: |
final public | function | Set an option for this handler. | |
CourseHandler:: |
final public | function | Set this entire handler's options. | |
CourseObjectFulfillment:: |
private | property | ||
CourseObjectFulfillment:: |
public | function | ||
CourseObjectFulfillment:: |
function | Get this fulfillment's course object. | ||
CourseObjectFulfillment:: |
function | Get this fulfillment's grade. | ||
CourseObjectFulfillment:: |
function | Is this fulfillment complete? | ||
CourseObjectFulfillment:: |
public | function |
Track course after saving fulfillment. Overrides CourseHandler:: |
|
CourseObjectFulfillment:: |
function | Set this fulfillment complete. | ||
CourseObjectFulfillment:: |
function | Set this fulfillment's grade. | ||
CourseObjectFulfillment:: |
function |
Construct the fulfillment object. Overrides CourseHandler:: |