class CourseObjectAccessGrade in Course 6
Same name and namespace in other branches
- 7.2 plugins/course_object_access/grade.inc \CourseObjectAccessGrade
- 7 plugins/course_object_access/grade.inc \CourseObjectAccessGrade
Hierarchy
- class \CourseHandler
- class \CourseObjectAccess
- class \CourseObjectAccessGrade
- class \CourseObjectAccess
Expanded class hierarchy of CourseObjectAccessGrade
File
- plugins/
course/ access/ grade.inc, line 11
View source
class CourseObjectAccessGrade extends CourseObjectAccess {
public function optionsDefinition() {
$defaults = parent::optionsDefinition();
$defaults += array(
'course_grade' => NULL,
'course_grade_hidden' => NULL,
);
return $defaults;
}
function take() {
$config = $this
->getOptions();
if ($this
->getCourseObject()
->getCourse()
->getTracker()
->getOption('grade_result') >= $config['course_grade']) {
return TRUE;
}
else {
$this
->getCourseObject()
->setAccessMessage('grade', t('You must have a grade of at least @grade% to take this activity.', array(
'@grade' => $this
->getOption('course_grade'),
)));
return FALSE;
}
}
function see() {
if (!$this
->take() && $this
->getOption('course_grade_hidden')) {
return FALSE;
}
}
function view() {
return $this
->take();
}
function optionsForm() {
$form = array();
$config = $this
->getOptions();
$form['course_grade'] = array(
'#title' => t('Course grade required'),
'#type' => 'textfield',
'#size' => 4,
'#description' => t('The user will not be able to access this object until this course grade is met.'),
'#default_value' => $config['course_grade'],
);
$form['course_grade_hidden'] = array(
'#title' => t('Hide until grade met'),
'#description' => t('The user will not see this object until the course grade is met.'),
'#type' => 'checkbox',
'#default_value' => $config['course_grade_hidden'],
);
return $form;
}
}
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:: |
private | function | Merge arrays with replace, not append. | |
CourseHandler:: |
public | function | Save data somewhere. | 1 |
CourseHandler:: |
public | function | Validate? | 3 |
CourseHandler:: |
public | function | 2 | |
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. | |
CourseObjectAccess:: |
private | property | ||
CourseObjectAccess:: |
public | function | ||
CourseObjectAccess:: |
public | function | ||
CourseObjectAccess:: |
function |
Overrides CourseHandler:: |
||
CourseObjectAccessGrade:: |
public | function |
Handlers need to declare their defaults if they have a configuration form. Overrides CourseHandler:: |
|
CourseObjectAccessGrade:: |
function |
Handlers can declare a form. Overrides CourseHandler:: |
||
CourseObjectAccessGrade:: |
function |
Overrides CourseObjectAccess:: |
||
CourseObjectAccessGrade:: |
function |
Overrides CourseObjectAccess:: |
||
CourseObjectAccessGrade:: |
function |
Overrides CourseObjectAccess:: |